ReactMoralisError: Provide a "appId" provided to <MoralisProvider> #5121
Answered
by
alymurtazamemon
Mayank-Pandey1
asked this question in
Q&A
-
while using the
Here is my app.js code: import "@/styles/globals.css"
import { MoralisProvider } from "react-moralis"
export default function App({ Component, pageProps }) {
return (
<MoralisProvider intializeOnMount={false}>
<Component {...pageProps} />
</MoralisProvider>
)
} Below is the index.js code: import Head from "next/head"
import Image from "next/image"
import { Inter } from "next/font/google"
import styles from "@/styles/Home.module.css"
import ManualHeader from "../components/ManualHeader"
const inter = Inter({ subsets: ["latin"] })
export default function Home() {
return (
<div>
<Head>
<title>Smart Contract Raffle</title>
<meta name="description" content="Our hardhat smart contract lottery DApp" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
<ManualHeader />
Hello
</div>
)
} the ManualHeader component code: import { useMoralis, isWeb3Enabled } from "react-moralis"
import { useEffect } from "react"
export default function Header() {
const { enableWeb3, account } = useMoralis() //useMoralis is a react Hook, it is used to track the state in our application
useEffect(() => {
console.log("Hi")
console.log(isWeb3Enabled)
}, [isWeb3Enabled])
//UseEffect function: 2 parameters: function, dependency array
//Anything in the dependency array changes, function executes
return (
<div>
{account ? (
<div>
Connected to {account.slice(0, 6)}...{account.slice(account.length - 4)}
</div>
) : (
<button
onClick={async () => {
await enableWeb3()
}}
>
Connect
</button>
)}
</div>
)
} |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Mar 19, 2023
Replies: 1 comment 1 reply
-
@Mayank-Pandey1 Correct the spelling |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Mayank-Pandey1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Mayank-Pandey1 Correct the spelling
initializeOnMount={false}