October 2019
Intermediate to advanced
426 pages
11h 49m
English
What if we wanted to add a checkbox that toggles the use of the first name field?
Let's find out by implementing such a checkbox:
const [ enableFirstName, setEnableFirstName ] = useState(false)
function handleEnableChange (evt) { setEnableFirstName(!enableFirstName) }
<input type="checkbox" value={enableFirstName} onChange={handleEnableChange} />
<h1>My name is: {enableFirstName ? name : ''} {lastName}</h1>
Read now
Unlock full access