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]]
|
||||
(when (not= (:value next-props) (.-value (.-state this)))
|
||||
(.setState this #js {:value (:value next-props)})))
|
||||
:should-component-update
|
||||
(fn [this old-argv new-argv]
|
||||
true)
|
||||
:reagent-render
|
||||
(fn [props & children]
|
||||
(this-as this
|
||||
(let [props (-> props
|
||||
(assoc :on-change (fn [e]
|
||||
(.setState this #js {:value (.. e -target -value)})
|
||||
(.forceUpdate this)
|
||||
(if-let [f (:on-change props)]
|
||||
(f e)))
|
||||
:value (.-value (.-state this)))
|
||||
|
|
Loading…
Reference in New Issue