2

In my React app, I'm checking for nextProps like so:

  componentWillReceiveProps(nextProps) {
    if (nextProps.invite && nextProps.invite.status) {
    }
  }

I need the above because it's possible nextProps.invite is undefined so if I had just nextProps.invite.status I would get a JS console undefined error...

Is there a cleaner, more efficient way to write the above logic?

halfer
  • 19,824
  • 17
  • 99
  • 186
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012

0 Answers0