1
I realized that we can use Redux and State to work on React. When to use one or the other?
1
I realized that we can use Redux and State to work on React. When to use one or the other?
4
Is used State within the logic of your component, to store some non-persistent information inherent in it, something that depending on that information you will use to render something or to fetch an api. Some common examples of the use of state are:
inputs
in a component Formulario
to give fetch when user click to sendrelógio
the state can be the time that the component will render on the screen, updating this value every second or minuteAlready the Redux is a state tree, which persists among the components. In general in the Act information is taken from father to son in the hierarchy through assignments in the props
of the components, but sometimes this structure starts to get very complex and you need in the same given components at very different levels of hierarchy. Redux enables you to access a "global" state between the components that make up it.
State and Redux are very different things, while state is a native basic concept of React Redux is a very useful third-party package in the development of complex apps.
A tip that I give you that is starting with React is to learn the basics before, build some components and look for some projects to develop, the moment you start having problems with passing data from parent to child components within your app is most likely the right time for you to learn about Redux.
Browser other questions tagged react redux
You are not signed in. Login or sign up in order to post.