I'm new to React and looking for a clue to disable an input text box when a corresponding checkbox is ticked. Below is my code:
const [checked, setChecked] = useState(false);
const [disable, setDisable] = useState(true);
<div>
<div>
<input
type="checkbox"
value={!checked}
onChange={() => setDisable(!disable)}
disable={!disable}
/>
</div>
<div>
<input
type="text"
placeholder="Enter correct detail"
disabled={!disable}
onChange={() => setChecked(true)}
/>
</div>
</div>;
The above code works for only a row. How do I implement this logic to be able to work for several other rows.