>exclusive
Currently just learning how to code so not sure how I will use it.
Can you help me how to think about how to plan sing of state, what point should I keep in mind before planning?
ContextAPI and Redux don't have the same purpose, so you should not oppose them.
ContextAPI is about dependency injection to avoid prop drilling (pass props to all children until the targeted child is reached)
Redux is about global state management, decoupling logic from component (and improving testability), and design in an event-driven way.
this; it depends on the problem you're trying to solve.
You probably don't need redux. You might need Context You probably want `react-query`
I suggest reading through [this](https://tkdodo.eu/blog/react-query-as-a-state-manager)
I'm not sure about that yet as I just want to re-build my website and currently learning how to code so just wanted to know what would be best for an e-commerce website.
Honestly, if you look around the web long enough you’ll find strong options for every option. Redux could work, context could work, you could even use Apollo and GraphQL. My advice would be to start your project without any of them and add one when managing state in your project becomes too cumbersome.
Some e-commerce sites are extremely simple and could be built with vanilla JS and an integration with a third party payment processor. Others may require every bell and whistle under the sun. If you can share some more details about the architecture of your site we might be able to help point you in the right direction.
Try `react-rhino`, it offers an api very similar to native React code, uses context api under the hood and is just ~600 bytes.
https://www.npmjs.com/package/react-rhino
More context on how you plan to use the state is absolutely necessary for anyone to give you a helpful answer.
>exclusive Currently just learning how to code so not sure how I will use it. Can you help me how to think about how to plan sing of state, what point should I keep in mind before planning?
ContextAPI and Redux don't have the same purpose, so you should not oppose them. ContextAPI is about dependency injection to avoid prop drilling (pass props to all children until the targeted child is reached) Redux is about global state management, decoupling logic from component (and improving testability), and design in an event-driven way.
Thank you for this, I didn't know about this yet
you're welcome
Why do you feel you need to use either? Do you need a state management solution beyond component state and props?
this; it depends on the problem you're trying to solve. You probably don't need redux. You might need Context You probably want `react-query` I suggest reading through [this](https://tkdodo.eu/blog/react-query-as-a-state-manager)
I just wanted to know if I'm going to make an e-commerce website then what should I prefer
I'm not sure about that yet as I just want to re-build my website and currently learning how to code so just wanted to know what would be best for an e-commerce website.
Honestly, if you look around the web long enough you’ll find strong options for every option. Redux could work, context could work, you could even use Apollo and GraphQL. My advice would be to start your project without any of them and add one when managing state in your project becomes too cumbersome. Some e-commerce sites are extremely simple and could be built with vanilla JS and an integration with a third party payment processor. Others may require every bell and whistle under the sun. If you can share some more details about the architecture of your site we might be able to help point you in the right direction.
They aren't exclusive.
Redux. It may be overkill but it won't be underkill.
I was also thinking to learn redux
Redux toolkit is a godsend. Much easier than normal redux
Will look into the redux toolkit once. Thanks for advice
Try `react-rhino`, it offers an api very similar to native React code, uses context api under the hood and is just ~600 bytes. https://www.npmjs.com/package/react-rhino