React/Redux - Get Value of Input

React/Redux - Get Value of Input


When creating React applications avoid components with own state. Instead I have to use stateless components.

Why is this good?
When I have a component with an input, I have to create a state only for this one input value. Is this okay?


You can still create local state in components when using Redux with React. Really, it’s about learning where state should be stored from a design standpoint: if you have some piece of state that multiple components need access to this is a good candidate for using Redux to manage this state. On the other hand, if you have a form and you wanted to locally validate the state of that form, only that component will need to know about that, so you can create local state to handle that in that component.


thanks for your fast answer :slight_smile:

When I have the common file structer where I seperate Containers and Components is my ‘‘Component’’ with the own state for the input to save in Containers or Components folder?

This ‘‘Component’’ is know didn’t stateless and I would save it in Containers.

I have some problems with React/Redux :confused:


So generally I think the notion is that if you have a component that is connected directly to Redux that is probably going to be classified as a container component. A container component is capable of actually updating the app state in the Redux store. In contrast, a component just receives data as props and renders that data. The distinction can get a little tricky when it comes to really deciding if something is a container or a component. Components are also referred to as presentational sometimes. This page in the Redux docs discusses this and may help to clarify it.