CheckBox with Disabled button

Prafull Kumar
Jul 28, 2021

I am not gonna go with full explanation as you already know what your are expecting for

So lets get to the Code

import React, { useState } from "react";const CheckboxExampleToggle = () => {const [name, setName] = useState(false);const handleChange = () => {setName(!name);};return (<div><h1>Without usign any library</h1><input type="checkbox" checked={name} onChange={handleChange} />{} Select the terms and condition<br /><br/><buttondisabled={!name}style={{ color: name ? "green " : "red", padding: "10px" }}>Register</button></div>);};export default CheckboxExampleToggle;

Happy coding…..

--

--