diff --git a/web/splash/splash.react.js b/web/splash/splash.react.js index b25480897..aea48f759 100644 --- a/web/splash/splash.react.js +++ b/web/splash/splash.react.js @@ -1,41 +1,29 @@ // @flow import * as React from 'react'; import LogInModal from '../modals/account/log-in-modal.react'; import { useModalContext } from '../modals/modal-provider.react'; import css from './splash.css'; -type Props = { - +setModal: (modal: React.Node) => void, - +modal: ?React.Node, -}; -class Splash extends React.PureComponent { - render() { - return ( - -
-

Log in

-
- {this.props.modal} -
- ); - } +function Splash(): React.Node { + const modalContext = useModalContext(); + const onClickLogIn = React.useCallback( + (event: SyntheticEvent) => { + event.preventDefault(); + modalContext.setModal(); + }, + [modalContext], + ); - onClickLogIn = (event: SyntheticEvent) => { - event.preventDefault(); - this.props.setModal(); - }; + return ( + +
+

Log in

+
+ {modalContext.modal} +
+ ); } -const ConnectedSplash: React.ComponentType<{}> = React.memo<{}>( - function ConnectedSplash(): React.Node { - const modalContext = useModalContext(); - - return ( - - ); - }, -); - -export default ConnectedSplash; +export default Splash;