Props not loading before Render?

Responses (2)

Join the discussion

like @topey said i am using something like

componentDidMount() { if(!this.props.user) { //fetch or dispatch } }

Write a reply...

Sounds like the prop is asynchronous? In that case I would usually put a check in your render method to exit early when this prop is not set then check it in the componentWillReceiveProps lifecycle event.

@topey So I tried putting an if else in there. and use componentWillReceiveProps to update state and but it doesn't seem in be firing.

And I get this.state.user is null when I refresh...

Write a reply...

loading ...