From 8095487476f824acac8941e5d6edab7d3805f8d3 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 12 Feb 2019 21:22:50 +0200 Subject: [PATCH] Update Toggle --- snippets/Toggle.md | 59 ++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/snippets/Toggle.md b/snippets/Toggle.md index 92e86ab16..fc28ef00d 100644 --- a/snippets/Toggle.md +++ b/snippets/Toggle.md @@ -2,49 +2,30 @@ Renders a toggle component. -Initialize `state.isToggleOn` to `false`, bind the `handleClick` method to the component's context. +Use the `React.useState()` to initialize the `isToggleOn` state variable to `false`. 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 ` - ); - } + return ( + + ); } ```