Skip to content

Commit

Permalink
Migrate ArchiveNotifier from UNSAFE_componentWillReceiveProps (#614)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
  • Loading branch information
tklever committed Aug 15, 2020
1 parent 9cc67df commit dac8c4a
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 dac8c4a

Please sign in to comment.