There's a faster version of egghead. Click here to try it.
Become a member
to unlock all features

    Support a state change handler for all control props


    In our simple situation, having an onToggleChange handler is sufficient because the on state is the only state we have, but in a more complex component, there could be many items of state. We could make an prop callback for each of those items of state, but that could drastically increase the complexity and repetition of our component. Instead, let's make an onStateChange that's called when any state changes.