[SOLVED] React Moralis: Error: Web3Api not initialized, run Moralis.start() first

I using React Moralis and I keep getting this error.

Uncaught (in promise) Error: Web3Api not initialized, run Moralis.start() first

I followed the tutorial on how to connect to Moralis with react and everything is similar
in my index.ts file

<MoralisProvider serverUrl="url" appId="APP_ID">
      <App />
    </MoralisProvider>

And imported MoralisWeb3Api in my App.js file

import { useMoralisWeb3Api } from "react-moralis";

Is there any reason why this is happening?.

If you’re doing it in a useEffect hook, you can run that by checking if isInitialized is true

I check and Moralis is initialized

I’ve solved the issue now, thanks.