DEV Community

Athul A
Athul A

Posted on

useState hooks in react

Hey,
It's my first post in dev.to, I am looking forward to learn different types of technology and their implementations,peoples thoughts etc through this platform.
I am currently learning Reactjs

Today i learned about the useState **hook in reactjs. It was interesting and at the same time it was much confusing but I got the concept behind it and then onwards I was able to code fastly. I also given a try to **useReducer hook which is an alternative to useState hook and it should be used when a state depends upon the value of another state.It also helps to reduce the number states in the code thus we are able to reduce the code length.And it's the programmer choice to choose useState or useReducer.If the logic is not much complex then useState will be the better choice whereas in the case of complex code useReducer should be apt.

Thank you!

Top comments (0)