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
If you know CSS then you can use these amazing generators and save your time
Thread π§΅ππ»
1οΈβ£ CSS Box Shadow Generator
- Generate CSS3 Box Shadow code for your Div, Frame, Buttons or any other HTML element with Outline, and Inset (inner) type shadow effects
π https://t.co/6La36IzBLj
2οΈβ£ Glassmorphism
- Generate glassmorphic design easily
π https://t.co/qrKqDV5tzY
3οΈβ£ Cool Backgrounds
- Explore a beautifully curated selection of cool backgrounds that you can add to your next project
π https://t.co/df7VSaRSh9
4οΈβ£ Pixel art
- Create CSS pixel art, export the results to CSS and download them.
π https://t.co/ojD8qwzuhx
Thread π§΅ππ»
1οΈβ£ CSS Box Shadow Generator
- Generate CSS3 Box Shadow code for your Div, Frame, Buttons or any other HTML element with Outline, and Inset (inner) type shadow effects
π https://t.co/6La36IzBLj
2οΈβ£ Glassmorphism
- Generate glassmorphic design easily
π https://t.co/qrKqDV5tzY
3οΈβ£ Cool Backgrounds
- Explore a beautifully curated selection of cool backgrounds that you can add to your next project
π https://t.co/df7VSaRSh9
4οΈβ£ Pixel art
- Create CSS pixel art, export the results to CSS and download them.
π https://t.co/ojD8qwzuhx
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 }
5 great gradient background sites for every web developer and designer π¨
π§΅ππ»
1οΈβ£ uiGradients
- A handpicked collection of beautiful color gradients for designers and developers.
π https://t.co/EainhiePop
2οΈβ£ Eggradient
- Ready to use gradient background colors. β Cool Gradients are prepared according to the latest design trends
π https://t.co/F0uYVsZbA4
3οΈβ£ Mesh Gradients
- Create beautiful gradient like aurora UI in few clicks
π https://t.co/MV8PT7q3Kz
4οΈβ£ CSS Gradient
- Create beatiful gradeint either linear or radial on different angles
π https://t.co/dlCExilHAT
π§΅ππ»
1οΈβ£ uiGradients
- A handpicked collection of beautiful color gradients for designers and developers.
π https://t.co/EainhiePop
2οΈβ£ Eggradient
- Ready to use gradient background colors. β Cool Gradients are prepared according to the latest design trends
π https://t.co/F0uYVsZbA4
3οΈβ£ Mesh Gradients
- Create beautiful gradient like aurora UI in few clicks
π https://t.co/MV8PT7q3Kz
4οΈβ£ CSS Gradient
- Create beatiful gradeint either linear or radial on different angles
π https://t.co/dlCExilHAT
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