mirror of https://github.com/status-im/reagent.git
Merge pull request #298 from reagent-project/react-15.5
Update to React 15.5, use create-react-class
This commit is contained in:
commit
0b91bc2580
|
@ -5,8 +5,9 @@
|
|||
|
||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||
[org.clojure/clojurescript "1.8.51"]
|
||||
[cljsjs/react-dom "15.4.2-2"]
|
||||
[cljsjs/react-dom-server "15.4.2-2"]]
|
||||
[cljsjs/react-dom "15.5.4-0"]
|
||||
[cljsjs/react-dom-server "15.5.4-0"]
|
||||
[cljsjs/create-react-class "15.5.3-0"]]
|
||||
|
||||
:plugins [[lein-cljsbuild "1.1.5"]
|
||||
[lein-codox "0.10.3"]]
|
||||
|
|
|
@ -264,7 +264,7 @@
|
|||
{:pre [(map? body)]}
|
||||
(->> body
|
||||
cljsify
|
||||
($ util/react createClass)))
|
||||
util/create-class))
|
||||
|
||||
(defn component-path [c]
|
||||
(let [elem (some-> (or (some-> c ($ :_reactInternalInstance))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(ns reagent.impl.util
|
||||
(:require [cljsjs.react]
|
||||
[cljsjs.create-react-class]
|
||||
[reagent.debug :refer-macros [dbg log warn]]
|
||||
[reagent.interop :refer-macros [$ $!]]
|
||||
[clojure.string :as string]))
|
||||
|
@ -10,6 +11,12 @@
|
|||
(throw (js/Error. "require('react') failed")))
|
||||
:else (throw (js/Error. "js/React is missing"))))
|
||||
|
||||
(defonce create-class
|
||||
(cond (exists? js/createReactClass) js/createReactClass
|
||||
(exists? js/require) (or (js/require "create-react-class")
|
||||
(throw (js/Error. "require('create-react-class') failed")))
|
||||
:else (throw (js/Error. "js/createReactClass is missing"))))
|
||||
|
||||
(def is-client (and (exists? js/window)
|
||||
(-> js/window ($ :document) nil? not)))
|
||||
|
||||
|
|
|
@ -459,16 +459,15 @@
|
|||
(is (= (rstr (ae [:div [:div "foo"]]))
|
||||
(rstr (ae [:div (ce "div" nil "foo")]))))))
|
||||
|
||||
(def ndiv ($ util/react
|
||||
createClass
|
||||
#js{:displayName "ndiv"
|
||||
:render
|
||||
(fn []
|
||||
(this-as
|
||||
(def ndiv (util/create-class
|
||||
#js {:displayName "ndiv"
|
||||
:render
|
||||
(fn []
|
||||
(this-as
|
||||
this
|
||||
(r/create-element
|
||||
"div" #js{:className ($ this :props.className)}
|
||||
($ this :props.children))))}))
|
||||
"div" #js{:className ($ this :props.className)}
|
||||
($ this :props.children))))}))
|
||||
|
||||
(deftest test-adapt-class
|
||||
(let [d1 (r/adapt-react-class ndiv)
|
||||
|
@ -924,7 +923,7 @@
|
|||
comp4 (fn comp4 []
|
||||
(for [i (range 0 1)]
|
||||
[:p "foo"]))
|
||||
nat ($ util/react createClass #js{:render (fn [])})
|
||||
nat (util/create-class #js {:render (fn [])})
|
||||
pkg "reagenttest.testreagent."
|
||||
stack1 (str "in " pkg "comp1")
|
||||
stack2 (str "in " pkg "comp2 > " pkg "comp1")
|
||||
|
|
Loading…
Reference in New Issue