Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Update on Async Rendering #8

Open
duncanheffron opened this issue Aug 21, 2019 · 0 comments
Open

React Update on Async Rendering #8

duncanheffron opened this issue Aug 21, 2019 · 0 comments

Comments

@duncanheffron
Copy link

React is updating their way of handling the componentWillReceiveProps, so if you get this error.

You can update this:

componentWillReceiveProps(nextProps) {
    if(nextProps.UI.errors){
      this.setState({ errors: nextProps.UI.errors });
    }
  }

to this:

static getDerivedStateFromProps(props) {
    if (props.UI.errors) {
      return {
        errors: props.UI.errors
      }
    }
  }

you could keep using the first function above but would need to change it into UNSAFE_componentWillReceiveProps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant