mirror of https://github.com/status-im/reagent.git
Update ReactFeatures.md
This commit is contained in:
parent
078976de26
commit
e1075a410c
|
@ -58,7 +58,7 @@ You can use `getDerivedStateFromError` (since React 16.6.0 and Reagent 0.9) (and
|
||||||
(let [error (r/atom nil)]
|
(let [error (r/atom nil)]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-catch (fn [this e info])
|
{:component-did-catch (fn [this e info])
|
||||||
:get-derived-state-from-error-test (fn [e]
|
:get-derived-state-from-error (fn [e]
|
||||||
(reset! error e)
|
(reset! error e)
|
||||||
#js {})
|
#js {})
|
||||||
:reagent-render (fn [comp]
|
:reagent-render (fn [comp]
|
||||||
|
@ -78,7 +78,7 @@ can be more obvious with the new `getDerivedStateFromError` method:
|
||||||
{:constructor (fn [this props]
|
{:constructor (fn [this props]
|
||||||
(set! (.-state this) #js {:error nil}))
|
(set! (.-state this) #js {:error nil}))
|
||||||
:component-did-catch (fn [this e info])
|
:component-did-catch (fn [this e info])
|
||||||
:get-derived-state-from-error-test (fn [error] #js {:error error})
|
:get-derived-state-from-error (fn [error] #js {:error error})
|
||||||
:render (fn [this]
|
:render (fn [this]
|
||||||
(r/as-element
|
(r/as-element
|
||||||
(if @error
|
(if @error
|
||||||
|
|
Loading…
Reference in New Issue