hey i am using moralis 2.9.0. now and working on next js project .here is my _app.js. code
import React,{useState,useEffect} from âreactâ
import âbootstrap/dist/css/bootstrap.cssâ
import ââŚ/styles/globals.cssâ;
import { MoralisProvider } from âreact-moralisâ;
import StatusContext from â@/store/status-contextâ;
import Moralis from âmoralisâ;
import Layout from â./components/Layout/Layoutâ;
export default function App({ Component, pageProps }) {
const [account, setAccount] = useState("");
const [currentNetwork, setCurrentNetwork] = useState(âmainnetsâ);
const testnets = {
chains: {
âmatic testnetâ: âMumbai (Matic Testnet)â,
ropsten: âRopsten Testnetâ,
âbsc testnetâ: âBSC Testnetâ,
âavalanche testnetâ: âAvalanche Testnetâ,
},
};
const mainnets = {
chains: {
eth: âEthereum Mainnetâ,
bsc: âBSC Mainnetâ,
matic: âPolygon (Matic) Mainnetâ,
avalanche: âAvalanche Mainnetâ,
eth_token: âEthereum Tokenâ,
btc_token: âBSC Tokenâ,
matic_token: âPolygon (Matic) Tokenâ,
ava_token: âAvalanche Tokenâ,
},
};
const networks = currentNetwork === âtestnetsâ ? testnets : mainnets;
const MORALIS_APP_ID = âIxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9â;
const MORALIS_SERVER_URL = âhttps://xxxxxxxxxxxx.grandmoralis.com:2053/serverâ;
const [error, setError] = useState({
title: ââ,
message: ââ,
showErrorBox: false,
});
const [success, setSuccess] = useState({
title: ââ,
message: ââ,
showSuccessBox: false,
});
useEffect(() => {
console.log(âstartedâ);
Moralis.start({
apiKey:
âGomgxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrjmVP1JQ8â,
});
}, []);
return (
<>
<StatusContext.Provider value={[error, success, setSuccess, setError]}>
<Component {âŚpageProps} account={account} networks={networks} setAccount={setAccount} />
</StatusContext.Provider>
</>
)
}
getting error
Unhandled Runtime Error
Moralis SDK Error: [C0009] Modules are started already. This method should be called only one time.
on this line
Moralis.start({
apiKey:
âGomgxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrjmVP1JQ8â,
})