Last active
May 23, 2018 10:42
-
-
Save trueadm/079048c1e002ea0e718fcf15294197db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const State = React.createState(); | |
function MyComponent(props) { | |
return ( | |
<State | |
initialState={() => ({ counter: 0, lastProps: props, divRef: React.createRef() }) } | |
deriveState={state => ({ lastProps: props }) } | |
shouldUpdate={(state, nextState) => ... } | |
didMount={(state, setState) => ... } | |
getSnapshotBeforeUpdate={state => ... } | |
didUpdate={(state, setState, prevState, snapshot) => ... } | |
willUnmount={state => ... } | |
> | |
{(state, setState) => ( | |
... | |
)} | |
</State> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe
initialValue
but I don't thinkinitial
has enough meaning anything by itself. "Initial...what?".I also think
deriveState
andinitialState
are fine as is.