PAnalayzer
PAnalayzer

Reputation: 3

React + Redux Updated State Not Getting Re-Rendered

I am trying out React + Redux and I came upon the problem of the most people. React is not updating (re-rendering).

I have read other posts regarding the same issue but I am still unable to solve my problem.I was able to update the state but I am unable to update the props for the component.

What am I doing wrong here?

ActionCreator -

enter image description here

Reducer -

enter image description here

enter image description here

Store -

enter image description here

App -

enter image description here

React -

enter image description here

Developer Tools -

enter image description here

Upvotes: 0

Views: 158

Answers (1)

MariuszJasinski
MariuszJasinski

Reputation: 504

First thing I'd try to do its changing passing props from:

 ErrorMessage: state.ErrorMessage 

to particular props, in your case isVisible

 isVisible: state.ErrorMessage.isVisible

And of course after that update the line with visibility to:

visibility {this.props.isVisible}

Its because you're passing whole object and changing only props inside of it. My guess is that React doesnt detect changes like this. Let me know if it helps!

EDIT: I googled this issue and I found that, may be useful for you: http://redux.js.org/docs/FAQ.html#react-not-rerendering

Regards, Mariusz

Upvotes: 1

Related Questions