You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Lint removal: whitespace * Lint removal: semicolon * Lint removal: silence false-positive Quoting from https://reactjs.org/docs/react-component.html#componentdidupdate > componentDidUpdate(prevProps) { > // Typical usage (don't forget to compare props): > if (this.props.userID !== prevProps.userID) { > this.fetchData(this.props.userID); > } > } > > You may call **`setState()`** immediately in `componentDidUpdate()` > but note that **it must be wrapped in a condition** like in the > example above, or you’ll cause an infinite loop. It would also cause > an extra re-rendering which, while not visible to the user, can > affect the component performance. If you’re trying to “mirror” some > state to a prop coming from above, consider using the prop directly > instead. Read more about why copying props into state causes bugs. This particular use case is OK by those rules, so we disable the linting rule for that particular line and leave a comment explaining why.
0 commit comments