Can I set my input fields value to redux store value? Or may I need to copy the props to my local state for this?
<input
placeholder={props.placeholder}
value={props.value}
/>
props.value is coming from react-redux's Connect.
But I can't change the value of input, I think this is because props is read only
You can set value that way, it's correct. To change such input value you have to add
onChange
event handler that will dispatch an action updating corresponding value in Redux store (check React doc about controlled form fields):In above example the
updateValueInRedux
should be a function passed to component from Reduxconnect
as property ofmapDispatchToProps
argument that will dispatch an action updating Redux state. It should look like that:To add to what Bartek said, your action could look like this: