1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Advanced React Component Patterns Update

    This lesson was part of the Advanced React Component Patterns course, which has been updated to reflect the new patterns and API available in React 16.3+.

    Build a Toggle Component

    reactReact

    In this lesson, we’ll write a simple toggle component which will serve as the foundation for the rest of the course. Kent walks through how to create a simple toggle with React setState. He shows us how to extend the functionality of the toggle by safely adding an onToggle prop that gets called after state is updated. It is important to define default props when you are calling a method from props.