useReducer is preferable to useState when you have some complex state.
It accepts three parameter out of which two are mandatory I guess
The first one is reducer function and second one is initial state
useReducer returns two things
- The first one in current state
- The second one is a dispatch function using which you can change your current state by passing action type is dispatch.
I have created a sandbox for you. Play with the code for better understanding
Some general tips for writing an effective tweet or thread
🧵 👇🏼
1️⃣ Write about the things you are good at
I always try to write tweets related to web technologies. More specifiy I try to cover CSS, JavaScript and React. By writing about the stuff that you're good, you can share huge amount of knowledge from your tweet
{ 2 / 10 }
2️⃣ Support your point with an example
If you're writing about some coding tips or tricks, It would be great if you give a example in the form of image, video, gif or link