From 841ec978bae3297357c3157a3adf846648771770 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 14 Nov 2019 13:44:52 +0300 Subject: react-router-dom hooks --- vnext/src/ui/Login.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vnext/src/ui/Login.js') diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js index 883a4eab..0c6f5d0c 100644 --- a/vnext/src/ui/Login.js +++ b/vnext/src/ui/Login.js @@ -1,6 +1,5 @@ import React, { useEffect } from 'react'; - -import { withRouter } from 'react-router-dom'; +import { useLocation, useHistory } from 'react-router-dom'; import Icon from './Icon'; import Button from './Button'; @@ -14,8 +13,6 @@ import './Login.css'; /** * @typedef {Object} LoginProps * @property {import('../api').SecureUser} visitor - * @property {import('history').History} history - * @property {import('history').Location} location * @property {any} onAuth */ @@ -23,7 +20,10 @@ import './Login.css'; * Login page * @param {LoginProps} props */ -function Login({ visitor, history, location, onAuth }) { +function Login({ visitor, onAuth }) { + + const location = useLocation(); + const history = useHistory(); useEffect(() => { if (visitor.hash) { @@ -76,7 +76,7 @@ function Login({ visitor, history, location, onAuth }) { ); } -export default withRouter(Login); +export default Login; const socialButtonsStyle = { display: 'flex', -- cgit v1.2.3