What if you need to manage more complex states? Here useReducers comes into play
React Hooks are so powerful and especially some additional hooks.
Do you know there is an alternative to useState called useReducer hook? It is used to manage more complex states.
Let's look into detail 🧵👇🏻

What if you need to manage more complex states? Here useReducers comes into play

The second value is a dispatch function using which we can update our state.
Here is the complete syntax 👇🏻

I just implemented a basic code here. Basically, I am calling dispatch function on button click which will eventually call reducer function

Before that one thing to note here is that useReducer is for handling more complex states hence it is recommended to passing the current state as an object

Something like this 👇🏻

Play around with it here: https://t.co/6BlaBeul1U
Here is "payload" comes into play. It is used to pass the value which represents the payloads of the action.
For example, suppose I want to pass "temp" variable 👇🏻
https://t.co/6BlaBeul1U

Check out the code and try to play around with it for better understanding.
https://t.co/TCPEn0W3Pz
Check it out: https://t.co/nt4hZzInIR
More from Pratham
You can check out these websites if you're learning HTML, CSS and JavaScript 🧵...
HTML 🧱
1. Learn HTML
https://t.co/NlQZAFwthT
2. HTML best practice
https://t.co/PyPf3lP9bX
3. HTML
CSS 🎨
1. CSS reference
https://t.co/Hhk8NKglpf
2. Learn to code
https://t.co/CLEsHgSrEk
3. CSS layout
https://t.co/9yiXkP3mWi
4. CSS tutorial
https://t.co/fR6AeVTdZv
5. Learn about colors
https://t.co/7vrD10j0jU
6. Learn gird
JavaScript ⚙️
1. JavaScript visualizer
https://t.co/9NId4GjGAq
2. Learn JavaScript
https://t.co/5WbtISS11I
https://t.co/4h27qOC1fO
3. JavaScript tutorial
https://t.co/taSKnEPxMS
4. JavaScript 30
https://t.co/j2wEIHVU8S
5. JavaScript
HTML 🧱
1. Learn HTML
https://t.co/NlQZAFwthT
2. HTML best practice
https://t.co/PyPf3lP9bX
3. HTML
CSS 🎨
1. CSS reference
https://t.co/Hhk8NKglpf
2. Learn to code
https://t.co/CLEsHgSrEk
3. CSS layout
https://t.co/9yiXkP3mWi
4. CSS tutorial
https://t.co/fR6AeVTdZv
5. Learn about colors
https://t.co/7vrD10j0jU
6. Learn gird
JavaScript ⚙️
1. JavaScript visualizer
https://t.co/9NId4GjGAq
2. Learn JavaScript
https://t.co/5WbtISS11I
https://t.co/4h27qOC1fO
3. JavaScript tutorial
https://t.co/taSKnEPxMS
4. JavaScript 30
https://t.co/j2wEIHVU8S
5. JavaScript
5 great code snippet websites for every web developer and designer
🧵👇🏻
1️⃣ 30 Seconds of Code
- Short code snippets for all your development needs
🔗 https://t.co/91L4bAxkgF
2️⃣ Free Frontend
- Free hand-picked HTML, CSS and JavaScript (jQuery, React, Vue) code examples, tutorials and articles
🔗 https://t.co/2sIAm73EdZ
3️⃣ Little Snippets
- A free collection of HTML and CSS code snippets
🔗 https://t.co/qxAyA2wA6U
4️⃣ CSS Deck
- Collection of Awesome CSS and JS Creations to help out frontend developers and designers.
🔗 https://t.co/LcZYnipvCy
🧵👇🏻

1️⃣ 30 Seconds of Code
- Short code snippets for all your development needs
🔗 https://t.co/91L4bAxkgF

2️⃣ Free Frontend
- Free hand-picked HTML, CSS and JavaScript (jQuery, React, Vue) code examples, tutorials and articles
🔗 https://t.co/2sIAm73EdZ

3️⃣ Little Snippets
- A free collection of HTML and CSS code snippets
🔗 https://t.co/qxAyA2wA6U

4️⃣ CSS Deck
- Collection of Awesome CSS and JS Creations to help out frontend developers and designers.
🔗 https://t.co/LcZYnipvCy

5 amazing GitHub repositories for every self taught developer
A Thread 🧵
1️⃣ Computer Science
🎓 Path to a free self-taught education in Computer Science!
🔗 https://t.co/67jB5zqIes
2️⃣ Free Certifications
Curated list of free courses & certifications
🔗 https://t.co/4XtlAVlovs
3️⃣ Free Programming Books
📚 Freely available programming books
🔗 https://t.co/eOWLCtwtIV
4️⃣ JavaScript Question
A long list of (advanced) JavaScript questions, and their explanations ✨
🔗 https://t.co/UvEl1Esvh3
A Thread 🧵
1️⃣ Computer Science
🎓 Path to a free self-taught education in Computer Science!
🔗 https://t.co/67jB5zqIes

2️⃣ Free Certifications
Curated list of free courses & certifications
🔗 https://t.co/4XtlAVlovs

3️⃣ Free Programming Books
📚 Freely available programming books
🔗 https://t.co/eOWLCtwtIV

4️⃣ JavaScript Question
A long list of (advanced) JavaScript questions, and their explanations ✨
🔗 https://t.co/UvEl1Esvh3

65 JavaScript resources that can help you
Mega Thread 🧵 👇🏻
🔹 Websites
1. Java5cript
https://t.co/2gdB6LdfQ8
2. JavaScript Tutorial
https://t.co/YyH7YEZtOL
3. JavaScript 30
https://t.co/X2e6T9qFW5
4. JavaScript Info
https://t.co/GLcMZmyfC9
5. JavaScript by
🔹 Learn through visualizing
6. JS Visualizer
https://t.co/DKXfCA5bnv
7. UI dev visualizer
https://t.co/IsnNdAGANq
8. JS
🔹 Documents
9. MDN
https://t.co/XkMlZQOF0h
10. W3 Schools
https://t.co/aJB14ha9KT
11. DevDocs
https://t.co/sVwCCrYKwA
12. JavaScript Info
https://t.co/VJaTfVOIa8
13. JavaScript
🔹 GitHub repo
14. Modern JavaScript tutorials
https://t.co/vDgTJKbz74
15. Awesome JS Learning
https://t.co/CUCBjfJEcY
16. JS by example
https://t.co/VLT6dRwLSp
17. 33 JS concepts
https://t.co/F5KDOSaACD
18. 30 seconds of
Mega Thread 🧵 👇🏻
🔹 Websites
1. Java5cript
https://t.co/2gdB6LdfQ8
2. JavaScript Tutorial
https://t.co/YyH7YEZtOL
3. JavaScript 30
https://t.co/X2e6T9qFW5
4. JavaScript Info
https://t.co/GLcMZmyfC9
5. JavaScript by
🔹 Learn through visualizing
6. JS Visualizer
https://t.co/DKXfCA5bnv
7. UI dev visualizer
https://t.co/IsnNdAGANq
8. JS
🔹 Documents
9. MDN
https://t.co/XkMlZQOF0h
10. W3 Schools
https://t.co/aJB14ha9KT
11. DevDocs
https://t.co/sVwCCrYKwA
12. JavaScript Info
https://t.co/VJaTfVOIa8
13. JavaScript
🔹 GitHub repo
14. Modern JavaScript tutorials
https://t.co/vDgTJKbz74
15. Awesome JS Learning
https://t.co/CUCBjfJEcY
16. JS by example
https://t.co/VLT6dRwLSp
17. 33 JS concepts
https://t.co/F5KDOSaACD
18. 30 seconds of