October 2019
Intermediate to advanced
426 pages
11h 49m
English
Recall that when we created the UserBar component, we statically defined the user value. We are now going to replace this value with a State Hook!
Let's start modifying the UserBar component to make it dynamic:
import React, { useState } from 'react'
const user = 'Daniel Bugl'
Replace it with a State Hook, using an empty user '' as the default value:
const [ user, setUser ] = useState('')
if (user) { return <Logout user={user} setUser={setUser} /> } else { return ( <React.Fragment> <Login setUser={setUser} ...Read now
Unlock full access