jeudi 3 mars 2022

Button only appears when, checkbox is checked in React

I'm trying to make a submit button which shows up only when the checkbox is checked. How to do this?

const [checked, setChecked] = useState(false);
  if (checked == true) {
    console.log('show submit');
  } else {
    console.log('hide submit');
  }
  const handleChange = () => {
    setChecked(!checked);
    console.log(checked, 'hello there');

  };



Aucun commentaire:

Enregistrer un commentaire