Advanced React

Join the React Bootcamp

The React Bootcamp is 5 full weeks of professional React training to take you from wherever you are to top-tier React programmer in record time.

Lifetime Access

$79
Complete Package
Become a React Pro
Problem

Refs and Rendering

Fix this code so that the toggle component works and successfully toggles the Switch when clicked.

Note that you need to implement a different way to use state in React.

This lesson is part of the full version of the React Bootcamp.

Click here to purchase.
Already joined? Log in here

Transcript

References in React can store values.

Here in this toggle component, I'm using ref and passing it a default value of false, and calling this ref toggleRef. I'm going to link it to this enabled variable.

If enabled is true, the toggle switch is enabled. If false, then it's not switche...