Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Reaccionar history.push to localhost:3000 no redirigiendo

Estoy creando una página de inicio de sesión usando React. history.push("/") no está dirigiendo y este error en la consola: TypeError no detectado: no se pueden leer las propiedades de undefined (leyendo 'push').

Hice esto del tutorial y seguí los códigos exactamente, pero aún no puedo descifrarlo durante días.

 import { useState } from "react"; import styles from "./register.css"; import Login from "../../containers/login/index"; function Register({ props, history }) { const [name, setName] = useState(); const [email, setEmail] = useState(); const [password, setPassword] = useState(); function registerClicked() { if (name !== " " && email !== " " && password !== " ") { console.log(name, email, password); alert("Thanks for registering"); history.push("/"); } else { alert("Please register to continue"); } } return( <div className="regContainer"> <p className="registerTitle">Register to sign in</p> <input type="text" placeholder="Create username" onChange={(nameText) => setName(nameText.target.value)} /> <input type="text" placeholder="Email address" onChange={(emailText) => setEmail(emailText.target.value)} /> <input type="password" placeholder="Password" onChange={(passwordText) => setPassword(passwordText.target.value)} /> <button onClick={() => registerClicked()}>Register</button> <p className="loginInstead">Already have an account? Sign in instead</p> </div> ); } export default Register;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 import { useNavigate } from "react-router-dom" export default const Register = () => { const navigate = useNavigate(); if(...){ navigate('/') } return <div></div> }

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!