Message from JavaScript discussions

March 2019

— That is not the problem it gave the same result even when I use constructors


If you’re using class there’s an implicit constructor.
If you’re using class components you will need binds.

— I have tried it that way already by using constructors and even binding the onChange to the constructor but i get the same result. It is populating the form but i cannot edit the form

Message permanent page

— I’m trying to replicate your component in a sandbox but you make this hard without providing the sandbox by yourself.
The other thing is on your method componentDidMount you’re calling directly the action creator, not the connected one. You have to use this.props.fetchSingleMasterAgent in order to use the connected with your redux one.

Message permanent page

— Yes. I did that because when I refresh the edit form page I lose the content in the redux store thereby losing the user details that was initially populated in the form . But I have removed the componentDidMount() but I still get the same result.. The form is not editable but it is populated with the user details. But now since I have removed componentDidMount once I refresh the edit page i loose the values that was initially populated on the form

Message permanent page

— How do you mean when you say "making it hard without providing sandbox"? please lemme know in any way i can make it easy?

Message permanent page

— Yes, like a

— Alpha beta omega

— udval15 I found the problem.
> getDerivedStateFromProps is invoked right before calling the render method, both on the initial mount and on subsequent updates.

This means your state are being overwritten every render by the contents of your props.

Message permanent page

— Please what do I do to solve this?

— You will need to know if those props were used already

— How? is there an example i can follow I am still new using react.