diff --git a/snippets/Toggle.md b/snippets/Toggle.md new file mode 100644 index 000000000..92e86ab16 --- /dev/null +++ b/snippets/Toggle.md @@ -0,0 +1,57 @@ +### Toggle + +Renders a toggle component. + +Initialize `state.isToggleOn` to `false`, bind the `handleClick` method to the component's context. +Use an object, `style`, to hold the styles for individual components and their states. +Create a method, `handleClick`, which uses `Component.prototype.setState` to change the component's `state.toggleOn`. +In the `render()` method, destructure `state` and `style`, create a ` + ); + } +} +``` + +```jsx +ReactDOM.render(, document.getElementById('root')); +``` + + + +