Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

213
Visualizações
'useState is not a function' React deploy showing nothing

I have tried to deploy a basic React App (still v. early in the works). The page breaks on load- shows nothing but the background, and I have an error in the console '.useState is not a function'

Below is the component that is flagged up in the issue. And here is the link to the open sourced code: https://github.com/mariaalouisaa/3-in-1-react

Thank you in advance!!

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>
  );
}

This is the error message

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think you should import React too and import useState in correct way as it said in documentation:

import React, { useState } from 'react';
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda