Skip to content

Commit

Permalink
docs(react): rename Provider to SessionProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Jun 11, 2021
1 parent 43299cf commit 77b06fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ export interface DefaultSession extends Record<string, unknown> {

/**
* Returned by `useSession`, `getSession`, returned by the `session` callback
* and also the shape received as a prop on the `Provider` React Context
* and also the shape received as a prop on the `SessionProvider` React Context
*
* [`useSession`](https://next-auth.js.org/getting-started/client#usesession) |
* [`getSession`](https://next-auth.js.org/getting-started/client#getsession) |
* [`Provider`](https://next-auth.js.org/getting-started/client#provider) |
* [`SessionProvider`](https://next-auth.js.org/getting-started/client#sessionprovider) |
* [`session` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback)
*/
export interface Session extends Record<string, unknown>, DefaultSession {}
Expand Down
2 changes: 1 addition & 1 deletion types/react-client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ export interface SessionProviderProps {
* Can also be used to throttle the number of requests to the endpoint
* `/api/auth/session`.
*
* [Documentation](https://next-auth.js.org/getting-started/client#provider)
* [Documentation](https://next-auth.js.org/getting-started/client#sessionprovider)
*/
export const SessionProvider: React.FC<SessionProviderProps>
8 changes: 4 additions & 4 deletions www/docs/getting-started/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You can use the [session callback](/configuration/callbacks#session-callback) to

The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.

It works best when the [`<SessionProvider>`](#provider) is added to `pages/_app.js`.
It works best when the [`<SessionProvider>`](#sessionprovider) is added to `pages/_app.js`.

#### Example

Expand Down Expand Up @@ -304,9 +304,9 @@ where `data.url` is the validated url you can redirect the user to without any f

---

## Provider
## SessionProvider

Using the supplied React `<SessionProvider>` allows instances of `useSession()` to share the session object across components, by using [React Context](https://reactjs.org/docs/context.html) under the hood. It also takes care of keeping the session updated and synced between tabs/windows.
Using the supplied `<SessionProvider>` allows instances of `useSession()` to share the session object across components, by using [React Context](https://reactjs.org/docs/context.html) under the hood. It also takes care of keeping the session updated and synced between tabs/windows.

```jsx title="pages/_app.js"
import { SessionProvider } from "next-auth/react"
Expand Down Expand Up @@ -477,6 +477,6 @@ More information can be found in the following [Github Issue](https://github.com
There is also an alternative client-side API library based upon [`react-query`](https://www.npmjs.com/package/react-query) available under [`nextauthjs/react-query`](https://github.com/nextauthjs/react-query).
If you use `react-query` in your project already, you can leverage it with NextAuth.js to handle the client-side session management for you as well. This replaces NextAuth.js's native `useSession` and `Provider` from `next-auth/react`.
If you use `react-query` in your project already, you can leverage it with NextAuth.js to handle the client-side session management for you as well. This replaces NextAuth.js's native `useSession` and `SessionProvider` from `next-auth/react`.
See repository [`README`](https://github.com/nextauthjs/react-query) for more details.
2 changes: 1 addition & 1 deletion www/docs/getting-started/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import NextAuth from "next-auth"

declare module "next-auth" {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
interface Session {
user: {
Expand Down

0 comments on commit 77b06fe

Please sign in to comment.