Estoy creando un cuadro de registro y cuando hago clic en iniciar sesión/registrarme necesito ir a otra ruta pero no sucede, ¿cuál es el problema? Se agregó el código completo de la página de registro. En utils/consts, se declaran las rutas, que he dado a continuación. ¿Qué más podría ser el problema?
import React from 'react'; import {Button, Card, Container, Form, NavLink, Row} from "react-bootstrap"; import {LOGIN_ROUTE, REGISTRATION_ROUTE} from "../utlis/consts"; import {useLocation} from "react-router-dom"; const Auth = () => { const location = useLocation(); const isLogin = location.pathname === LOGIN_ROUTE; console.log(location); return ( <Container className="d-flex justify-content-center align-items-center" style={{height:window.innerHeight - 54}} > <Card style={{width: 600}} className="p-5"> <h2 className="m-auto">{isLogin ? 'Авторизация' : "Регистрация"}</h2> <Form className="d-flex flex-column"> <Form.Control className="mt-3" placeholder="Enter your email..." /> <Form.Control className="mt-3" placeholder="Enter you password..." /> <Row className="d-flex justify-content-between mt-3 pl-3 pr-3"> {isLogin ? <div> Don't have an account?<NavLink to={REGISTRATION_ROUTE}>Register!</NavLink> </div> : <div> Have an account?<NavLink to={LOGIN_ROUTE}>Login!</NavLink> </div> } <Button variant={"outline-success"} > {isLogin ? 'Login' : 'Registration'} </Button> </Row>Las rutas a las constantes se registran:
export const LOGIN_ROUTE = '/login' export const REGISTRATION_ROUTE = '/registration'