adrianhajdin / project_next_14_ai_prompt_sharing

Next.js recently became the official React framework as outlined in React docs. In this course, you'll learn the most important Next.js concepts and how they fit into the React ecosystem. Finally, you'll put your skills to the test by building a modern full-stack Next 14 application.
https://www.jsmastery.pro/ultimate-next-course
2.9k stars 426 forks source link

Error: [next-auth]: `useSession` must be wrapped in a <SessionProvider /> #16

Open Abdifatah-said opened 1 year ago

Abdifatah-said commented 1 year ago

image

iam encountering this error, how should i fix it.

thank you.

Alxcalex commented 1 year ago

Hi there, did you solved this problem ?

Abdifatah-said commented 1 year ago

no still i didnt solve it

YugBhanushali commented 1 year ago

In Provider.jsx wrap it with SessionProvider and in layout.js wrap body with Provider

Nith567 commented 1 year ago

just wrap like this:

    <Provider>
      <Nav/>
      {children}
      </Provider>
gr8guyrabi commented 1 year ago

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>
yuvraj042003 commented 1 year ago

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>

Yes This is right code

CreativeRoutine commented 1 year ago

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>

Yes This is right code

This renders only

Provider
. What did i wrong?