mirror of https://github.com/status-im/reagent.git
Add note about using local foreign-lib definitions
This commit is contained in:
parent
a3b9b48ff2
commit
3f8350463c
|
@ -12,6 +12,32 @@ if you have direct dependencies to them.
|
|||
If you use additional React packages, you need to update Cljsjs packages
|
||||
for these to use new React foreign-lib name, `react` instead of `cljsjs.react`.
|
||||
**Subject to change, if this can be solved easily.**
|
||||
As a quick fix, you can add updated foreign-lib definition to your project,
|
||||
like following example for react-leaflet, and update your project
|
||||
to refer to the new name, and at the same time your can start using
|
||||
`:global-exports`:
|
||||
|
||||
```cljs
|
||||
:foreign-libs [{:file "cljsjs/development/react-leaflet.inc.js"
|
||||
:file-min "cljsjs/production/react-leaflet.min.inc.js"
|
||||
:provides ["react-leaflet"]
|
||||
:requires ["react"]
|
||||
:global-exports {react-leaflet ReactLeaflet}}]}}
|
||||
```
|
||||
|
||||
Old code:
|
||||
```cljs
|
||||
(ns ... (:require cljsjs.react-leaflet))
|
||||
|
||||
(def Map (r/adapt-react-class js/ReactLeaflet.Map))
|
||||
```
|
||||
|
||||
New code:
|
||||
```cljs
|
||||
(ns ... (:require [react-leaflet :as react-leaflet]))
|
||||
|
||||
(def Map (r/adapt-react-class react-leaflet/Map))
|
||||
```
|
||||
|
||||
## Browser - node modules
|
||||
|
||||
|
|
Loading…
Reference in New Issue