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

322
Visualizações
I am trying to create a react website and add hooks in it but face this erros
import { useState } from "react";
const TronWeb = require("tronweb");




const [lpLogged, setlpLogged] = useState(true);

async function getTronWeb() {
    if (window.tronWeb && window.tronWeb.defaultAddress.base58) {
      return window.tronWeb;
    }
    return null;} 

     let curweb = getTronWeb ();
   async function initWindow() { 
    if (curweb == null) {
    setlpLogged((lpLogged) => false);
      alert.show("We were unable to find any suitble providder.");
    } else {
      setlpLogged((lpLogged) => true);
    }
}

    <button onclick={initWindow}>Can you get tronweb from tronlink?</button>
    Compiled with problems:X

ERROR in ./src/App.js 12:35-39

export 'default' (imported as 'Body') was not found in './components/Body' (module has no exports)

ERROR

[eslint] src\components\Body.js Line 8:33: React Hook "useState" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks

Search for the keywords to learn more about each error.

this is the error i face while running it

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

0

try to fix the import : import React,{useState} from "react";

plus check the export method in Body component

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