mirror of https://github.com/status-im/reagent.git
Replace forceUpdate with shouldComponentUpdate
This commit is contained in:
parent
2825c8e172
commit
c29276bc6b
|
@ -15,13 +15,15 @@
|
||||||
(fn [this [_ next-props]]
|
(fn [this [_ next-props]]
|
||||||
(when (not= (:value next-props) (.-value (.-state this)))
|
(when (not= (:value next-props) (.-value (.-state this)))
|
||||||
(.setState this #js {:value (:value next-props)})))
|
(.setState this #js {:value (:value next-props)})))
|
||||||
|
:should-component-update
|
||||||
|
(fn [this old-argv new-argv]
|
||||||
|
true)
|
||||||
:reagent-render
|
:reagent-render
|
||||||
(fn [props & children]
|
(fn [props & children]
|
||||||
(this-as this
|
(this-as this
|
||||||
(let [props (-> props
|
(let [props (-> props
|
||||||
(assoc :on-change (fn [e]
|
(assoc :on-change (fn [e]
|
||||||
(.setState this #js {:value (.. e -target -value)})
|
(.setState this #js {:value (.. e -target -value)})
|
||||||
(.forceUpdate this)
|
|
||||||
(if-let [f (:on-change props)]
|
(if-let [f (:on-change props)]
|
||||||
(f e)))
|
(f e)))
|
||||||
:value (.-value (.-state this)))
|
:value (.-value (.-state this)))
|
||||||
|
|
Loading…
Reference in New Issue