React Hook for Furo
// src/App.js import React from 'react'; import { useFuro } from 'furo-react'; function App() { const { isLoading, isAuthenticated, user, loginWithRedirect, logout } = useFuro(); const onLogout = () => { logout(); loginWithRedirect(); }; if (isLoading) { return <div>Loading...</div>; } if (isAuthenticated) { return ( <div> Hello {user.name} <button onClick={onLogout}>Log out</button> </div> ); } else { return <button onClick={loginWithRedirect}>{`Log in`}</button>; } } export default App;
const loginWithRedirect: () => void;
const logout: () => void;
const isLoading: boolean;
const isAuthenticated: boolean;
const isAuthenticated: User;
Was this page helpful?