diff --git a/react/features/welcome/components/AbstractWelcomePage.js b/react/features/welcome/components/AbstractWelcomePage.js index b67ca3f38..02d089ca2 100644 --- a/react/features/welcome/components/AbstractWelcomePage.js +++ b/react/features/welcome/components/AbstractWelcomePage.js @@ -37,6 +37,17 @@ type Props = { export class AbstractWelcomePage extends Component { _mounted: ?boolean; + /** + * Implements React's {@link Component#getDerivedStateFromProps()}. + * + * @inheritdoc + */ + static getDerivedStateFromProps(props: Props, state: Object) { + return { + room: props._room || state.room + }; + } + /** * Save room name into component's local state. * @@ -77,26 +88,15 @@ export class AbstractWelcomePage extends Component { } /** - * Implements React's {@link Component#componentWillMount()}. Invoked - * immediately before mounting occurs. + * Implements React's {@link Component#componentDidMount()}. Invoked + * immediately after mounting occurs. * * @inheritdoc */ - componentWillMount() { + componentDidMount() { this._mounted = true; } - /** - * Implements React's {@link Component#componentWillReceiveProps()}. Invoked - * before this mounted component receives new props. - * - * @inheritdoc - * @param {Props} nextProps - New props component will receive. - */ - componentWillReceiveProps(nextProps: Props) { - this.setState({ room: nextProps._room }); - } - /** * Implements React's {@link Component#componentWillUnmount()}. Invoked * immediately before this component is unmounted and destroyed.