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

169
Views
TypeError: no se pueden leer las propiedades de undefined (leyendo 'push')

Mensaje de error

Pude resolver este problema usando useNavigate

 let params = useParams(); let navigate = useNavigate(); const dispatch = useDispatch(); const productId = params.id; const [qty, setQty] = useState(1); const productDetails = useSelector((state) => state.productDetails); const { loading, error, product } = productDetails; useEffect(() => { dispatch(detailsProduct(productId)); }, [dispatch, productId]); const addToCartHandler = () => { navigate(`/cart/${productId}?qty=${qty}`); };

pero la página no mostró nada

Código

gracias

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Mientras usa componentes funcionales de reacción, debe usar ganchos

 import {useHistory} from 'react-router-dom' const App=()=>{ const history=useHistory() const submit=()=>{ history.push("/products/23") } }

para reaccionar enrutador v6

 import {useNavigate} from 'react-router-dom' const App=()=>{ const navigate=useNavigate() const submit=()=>{ navigate("/products/23") } }
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!