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
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
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
A complete beginner's guide to styling your website with CSS.
Thread π§΅ππ»
CSS is an amazing and unique language that servers a great purpose. We can make our website visually good using CSS. It describe the presentation of web pages, including typography,. layouts, color etc...
{ 2 / 27 }
First and foremost
The characterstic of a great website is it's color scheme. Forget about everything and learn about background and color properties initially.
The colors are something from which users interact first whenever they visit your webpage
{ 3 / 27 }
There are a lot of great color palette out there using which you can generate pleasant color schemes
Check this great tool for generating accessible colors
https://t.co/ndsgBaMv2M
{ 4 / 27 }
Don't think that background property is just for setting the solid color. Background is a shorthand property for background-image, background-position etc..
{ 5 / 27 }
Thread π§΅ππ»
CSS is an amazing and unique language that servers a great purpose. We can make our website visually good using CSS. It describe the presentation of web pages, including typography,. layouts, color etc...
{ 2 / 27 }
First and foremost
The characterstic of a great website is it's color scheme. Forget about everything and learn about background and color properties initially.
The colors are something from which users interact first whenever they visit your webpage
{ 3 / 27 }
There are a lot of great color palette out there using which you can generate pleasant color schemes
Check this great tool for generating accessible colors
https://t.co/ndsgBaMv2M
{ 4 / 27 }
Don't think that background property is just for setting the solid color. Background is a shorthand property for background-image, background-position etc..
{ 5 / 27 }
If you start with the right course then the process becomes a little easier
I found some amazing YouTube videos and courses that will help you start your Web Development journey
π§΅ππ»
HTML and CSS
- A great way to arouse your web dev journey with Gary's (@designcoursecom) course on YouTube
π https://t.co/xjm7nfV2L2
JavaScript
- Although it's impossible to learn JavaScript in 2 hours but JavaScript mastery is one the best YouTube chanel for JavaScript. This 2 hours long crash course will help you start your journey and gives you quick overview.
π https://t.co/1zcSeu4zKE
Git and GitHub
Git is an essential tool. And after learning JavaScript, I think one should go for Git and GitHub. Check out this free great course on Udemy
π https://t.co/E14cibOLXb
React
What you'll learn
- what problems React can solve
- how React solves those problems under the hood
- what JSX is and how it translates to regular JavaScript function calls and objects
- manage state with hooks
- build forms
π https://t.co/3z22aeVQFc
I found some amazing YouTube videos and courses that will help you start your Web Development journey
π§΅ππ»
HTML and CSS
- A great way to arouse your web dev journey with Gary's (@designcoursecom) course on YouTube
π https://t.co/xjm7nfV2L2
JavaScript
- Although it's impossible to learn JavaScript in 2 hours but JavaScript mastery is one the best YouTube chanel for JavaScript. This 2 hours long crash course will help you start your journey and gives you quick overview.
π https://t.co/1zcSeu4zKE
Git and GitHub
Git is an essential tool. And after learning JavaScript, I think one should go for Git and GitHub. Check out this free great course on Udemy
π https://t.co/E14cibOLXb
React
What you'll learn
- what problems React can solve
- how React solves those problems under the hood
- what JSX is and how it translates to regular JavaScript function calls and objects
- manage state with hooks
- build forms
π https://t.co/3z22aeVQFc
You May Also Like
Ivor Cummins has been wrong (or lying) almost entirely throughout this pandemic and got paid handsomly for it.
He has been wrong (or lying) so often that it will be nearly impossible for me to track every grift, lie, deceit, manipulation he has pulled. I will use...
... other sources who have been trying to shine on light on this grifter (as I have tried to do, time and again:
Example #1: "Still not seeing Sweden signal versus Denmark really"... There it was (Images attached).
19 to 80 is an over 300% difference.
Tweet: https://t.co/36FnYnsRT9
Example #2 - "Yes, I'm comparing the Noridcs / No, you cannot compare the Nordics."
I wonder why...
Tweets: https://t.co/XLfoX4rpck / https://t.co/vjE1ctLU5x
Example #3 - "I'm only looking at what makes the data fit in my favour" a.k.a moving the goalposts.
Tweets: https://t.co/vcDpTu3qyj / https://t.co/CA3N6hC2Lq
He has been wrong (or lying) so often that it will be nearly impossible for me to track every grift, lie, deceit, manipulation he has pulled. I will use...
... other sources who have been trying to shine on light on this grifter (as I have tried to do, time and again:
Ivor Cummins BE (Chem) is a former R&D Manager at HP (sourcre: https://t.co/Wbf5scf7gn), turned Content Creator/Podcast Host/YouTube personality. (Call it what you will.)
— Steve (@braidedmanga) November 17, 2020
Example #1: "Still not seeing Sweden signal versus Denmark really"... There it was (Images attached).
19 to 80 is an over 300% difference.
Tweet: https://t.co/36FnYnsRT9
Example #2 - "Yes, I'm comparing the Noridcs / No, you cannot compare the Nordics."
I wonder why...
Tweets: https://t.co/XLfoX4rpck / https://t.co/vjE1ctLU5x
Example #3 - "I'm only looking at what makes the data fit in my favour" a.k.a moving the goalposts.
Tweets: https://t.co/vcDpTu3qyj / https://t.co/CA3N6hC2Lq