Files
mern-template/client/src/App.js
2021-09-28 18:53:02 +03:00

25 lines
552 B
JavaScript

import {useAuth} from './contexts/AuthContext'
import Header from './components/Header'
export default function App() {
const {isLoggedIn} = useAuth()
return (
<div className='App'>
<Header />
{isLoggedIn ? <LoggedInText /> : <LoggedOutText />}
</div>
)
}
const LoggedInText = () => {
const {account} = useAuth()
return <p>Hey, {account.username}! I'm happy to let you know: you are authenticated!</p>
}
const LoggedOutText = () => (
<p>Don't forget to start your backend server, then authenticate yourself.</p>
)