Make Compound React Components Flexible
Our current compound component implementation is great, but it's limited in that users cannot render the structure they need. Let's allow the user to have more flexibility by using React context to share the implicit state to our child
<Toggle/> components. We will walk through safely defining
childContextTypes, providing the value with
getChildContext, and, on each of the components that need that context, we define
contextTypes so that React will pass the context that is being asked for.