Skip to content

Commit

Permalink
migrate ArchiveNotifier from UNSAFE_componentWillReceiveProps to getD…
Browse files Browse the repository at this point in the history
…erivedStateFromProps

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
  • Loading branch information
tklever committed Aug 12, 2020
1 parent fe67712 commit 3488148
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@ export default class ArchiveNotifier extends React.PureComponent<Props, State> {
this.state = { notifiedState };
}

// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const notifiedState = processProps(this.state.notifiedState, nextProps);
if (this.state.notifiedState !== notifiedState) {
this.setState({ notifiedState });
}
static getDerivedStateFromProps(props: Props, state: State) {
const notifiedState = processProps(state.notifiedState, props);
return { notifiedState };
}

componentWillUnmount() {
Expand Down

0 comments on commit 3488148

Please sign in to comment.