diff --git a/README.md b/README.md index 791740b..fa4cc90 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,10 @@ The `Callback` component will call the `.signinRedirectCallback()` method from ` ### `` -This component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Consumer`. +This component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Context`. ```jsx -{context =>

{context.user.id_token}

}
+{context =>

{context.user.id_token}

}
``` Render prop function diff --git a/src/index.ts b/src/index.ts index 2747e96..ed5dd55 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Consumer as UserData, makeAuthenticator } from './makeAuth' +import { AuthenticatorContext as UserData, makeAuthenticator } from './makeAuth' import makeUserManager from './makeUserManager' import Callback from './Callback' diff --git a/src/makeAuth/index.test.tsx b/src/makeAuth/index.test.tsx index 9d1d99a..7ad899b 100644 --- a/src/makeAuth/index.test.tsx +++ b/src/makeAuth/index.test.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import { fireEvent, render, waitForElement } from 'react-testing-library' -import { Consumer, makeAuthenticator } from './' +import { AuthenticatorContext, makeAuthenticator } from './' import makeUserManager from '../makeUserManager' import MockUserManager from '../utils/userManager' @@ -83,7 +83,7 @@ describe('makeAuthenticator', () => { const WithAuth = makeAuthenticator({ userManager: makeUserManager(userManagerConfig, MockUserManager) - })({({ signOut }) => }) + })({({ signOut }) => }) const { getByText, queryByText } = render() await successfulGetUser diff --git a/src/makeAuth/index.tsx b/src/makeAuth/index.tsx index 0ed2c59..c7acdcd 100644 --- a/src/makeAuth/index.tsx +++ b/src/makeAuth/index.tsx @@ -13,7 +13,7 @@ const DEFAULT_CONTEXT: IAuthenticatorContext = { user: null, userManager: null } -const { Consumer, Provider } = React.createContext( +const AuthenticatorContext = React.createContext( DEFAULT_CONTEXT ) @@ -93,7 +93,7 @@ function makeAuthenticator({ return placeholderComponent || null } return this.isValid() ? ( - {WrappedComponent} + {WrappedComponent} ) : (