• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

144
Views
'useState no es una función' React deployment que no muestra nada

He intentado implementar una aplicación React básica (todavía muy temprano en las obras). La página se rompe al cargar: no muestra nada más que el fondo, y tengo un error en la consola '.useState no es una función'

A continuación se muestra el componente que está marcado en el problema. Y aquí está el enlace al código fuente abierto: https://github.com/mariaalouisaa/3-in-1-react

¡¡Gracias de antemano!!

 import "./Home.css"; import home from "./images/home.png"; import TimeAndDate from "./TimeAndDate"; import Todo from "./Todo"; import Stopwatch from "./Stopwatch"; import { useState } from "react/cjs/react.development"; export default function Home() { const [dateVis, setsetDatevis] = useState(false); const [todoVis, setsetTodovis] = useState(false); const [stopVis, setsetStopvis] = useState(false); function popUp(e) { if (e.target.name === "date") setsetDatevis(true); if (e.target.name === "todo") setsetTodovis(true); if (e.target.name === "stop") setsetStopvis(true); } return ( <div> <button onClick={() => { setsetDatevis(false); setsetTodovis(false); setsetStopvis(false); }} className="homebutton" > <img src={home} alt={home} /> </button> <div className="Home"> <button name="date" onClick={popUp}> Time + Date </button> <button name="todo" onClick={popUp}> To-do {<br />}List </button> <button name="stop" onClick={popUp}> Stop- watch </button> <TimeAndDate active={dateVis} /> <Todo active={todoVis} /> <Stopwatch active={stopVis} /> </div> </div> ); }

este es el mensaje de error

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

0

Creo que también deberías importar React e importar useState de manera correcta como se dice en la documentación :

 import React, { useState } from 'react';
about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error