From 57f8977ba95686e514b5d4e5b81bb81c51eb1653 Mon Sep 17 00:00:00 2001 From: Andrey Grunev Date: Thu, 11 Feb 2021 15:44:32 +0200 Subject: [PATCH] Remove deprecated React lifecycle methods --- src/Provider.tsx | 4 ++-- src/editor/TranslationEditor.tsx | 2 +- src/translate.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Provider.tsx b/src/Provider.tsx index a3dba16..91a7310 100644 --- a/src/Provider.tsx +++ b/src/Provider.tsx @@ -35,7 +35,7 @@ export class Provider extends React.Component { // translator: () => {}, }; - componentWillMount() { + componentDidMount() { this.setState({ historyUnsubscribe: this.props.history ? this.props.history.listen(this.updateLocation) : undefined, }); @@ -47,7 +47,7 @@ export class Provider extends React.Component { // } } - componentWillUpdate(nextProps: ProviderProps) { + componentDidUpdate(nextProps: ProviderProps) { if (nextProps.pathname && this.connector && nextProps.pathname !== this.props.pathname) { this.connector.updateLocation(nextProps.pathname); } diff --git a/src/editor/TranslationEditor.tsx b/src/editor/TranslationEditor.tsx index 284be49..dfe311e 100644 --- a/src/editor/TranslationEditor.tsx +++ b/src/editor/TranslationEditor.tsx @@ -72,7 +72,7 @@ export class TranslationEditor extends React.PureComponent {}, }; - componentWillMount() { + componentDidMount() { const { store, translator } = this.context; const historyUnsubscribe = this.props.history ? this.props.history.listen(this.updateState) : undefined; diff --git a/src/translate.tsx b/src/translate.tsx index ad520e1..c3f94e6 100644 --- a/src/translate.tsx +++ b/src/translate.tsx @@ -51,7 +51,7 @@ export function translate

(scope?: string | string[], overrides?: MsgOptions): translator: PropTypes.object, }; - componentWillMount() { + componentDidMount() { const { store } = this.context; if (!store) { return;