From 83e6255ba45e4892eae8066f9427c4d26a5905a6 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 11 Apr 2019 17:16:42 -0400 Subject: [PATCH] update NotifyAndRedirect to function component --- src/components/NotifyAndRedirect.jsx | 66 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/components/NotifyAndRedirect.jsx b/src/components/NotifyAndRedirect.jsx index 1741c8813a..0bb030440a 100644 --- a/src/components/NotifyAndRedirect.jsx +++ b/src/components/NotifyAndRedirect.jsx @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React from 'react'; import { Redirect, withRouter } from 'react-router-dom'; @@ -6,39 +6,39 @@ import { Trans } from '@lingui/macro'; import { withRootDialog } from '../contexts/RootDialog'; -class NotifyAndRedirect extends Component { - constructor (props) { - super(props); +const NotifyAndRedirect = ({ + to, + push, + from, + exact, + strict, + sensitive, + setRootDialogMessage, + location +}) => { + setRootDialogMessage({ + title: '404', + bodyText: ( + + Cannot find route + {` ${location.pathname}`} + . + + ), + variant: 'warning' + }); - const { setRootDialogMessage, location } = this.props; - setRootDialogMessage({ - title: '404', - bodyText: ( - - Cannot find route - {` ${location.pathname}`} - . - - ), - variant: 'warning' - }); - } - - render () { - const { to, push, from, exact, strict, sensitive } = this.props; - - return ( - - ); - } -} + return ( + + ); +}; export { NotifyAndRedirect as _NotifyAndRedirect }; export default withRootDialog(withRouter(NotifyAndRedirect));