1.2.1 • Published 4 years ago
react-auth-wall v1.2.1
React Auth Wall
📦 Install
Install react-auth-wall
using yarn:
yarn add react-auth-wall
⚙️ Usage
User is considered authenticated when data
isn't falsy.
import React from 'react'
import { AuthWall } from 'react-auth-wall'
export const RootContainer = () => {
return (
<AuthWall
authHook={useAuth}
authComponent={() => <div>Login form</div>}
loaderComponent={() => <div>Loading...</div>}
>
My Web App
</AuthWall>
)
}
const useAuth = () => {
// ... user retrieval logic here
return { data: null, isLoading: false }
}