WARNING: This won't be easy, you are about to marry together two separate realms.
You want to start gradually using ClojureScript/Reagent in an existing JavaScript/React project.
reagent.core/reactify-component
to adapt Reagent component for usage with JS/React^:export
meta on component's function to export it into a global scope (window
object)<script>
tag referring ClojureScript output bundle into your HTML before JS project's scriptwindow
object)
<script>
tag referring shared deps bundle into your HTML before ClojureScript project's scriptcljsjs/react
and cljsjs/react-dom
transitive dependencies from reagent
dependency:foreign-libs
option alias react
and react-dom
with globally exported (from JS project) ones
:file
is a required field in :foreign-libs
, provide a path to an empty stub file
:infer-externs
to true
so that compiler can infer external references to shared depsOn every change to ClojureScript source Figwheel will apply a patch to the code running in the browser. In order to reflect those changes on the screen you have to re-render the app so the new code will be executed.
^:figwheel-hooks
meta to enable Figwheel hooks and ^:after-load
meta on a function that calls rendering function exported from JS