react-wordpress-auth
Made with create-react-library
Install
npm install --save react-wordpress-auth
Wrap your App
with the AuthProvider
in App.js
import React from 'react'import AuthProvider from 'react-wordpress-auth'const App = return <AuthProvider>/* ... */</AuthProvider>
Usage
import React from 'react'import useForm from 'react-hook-form'import useAuth from 'react-wordpress-auth' const Login = const handleSubmit register errors = const user loading isAuthenticated login signup isAuthenticating = if isAuthenticated return <div>Welcome userfirstName!</div> return <form => <label ='email'>Email</label> <input ='email' ='email' = /> errorsemail && errorsemailmessage <label ='password'>Password</label> <input ='password' ='password' = /> errorspassword && errorspasswordmessage <button ='submit' => loading ? 'Loading...' : 'Login' </button> </form> }
License
MIT © Moretape