-1
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

harsh
  • 5
  • 4

1 Answers1

-1

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

plus check the export method in Body component