All React Hooks

in react •  3 years ago  (edited)

Let's try to study all react hooks you gonna face

icon.png

useState

re-render is the key when things change. You can not change the value directly so have to use it with the function(setSth) in useState to mutate.

carbon.png

useReducer

function reducer() {
    return {...} // return a new state while keeping immutability 
}

carbon.png

reference
https://reactjs.org/docs/hooks-intro.html

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!