I am having a form and I am getting data from solutestate and the output is sent to the first input box using value={solutestate} but I want to toggle the output using the checkbox in the input box
Goal: when I check the check box the solutestate value should be in the first input box and if unchecked the output of the solutestate should be in second input box.
const [state, setState] = useState(false);
const [solutestate, setSoluteState] = useState();
<input
className="mr-2 leading-tight"
type="checkbox"
onChange={setState}
/>
<form
noValidate
onSubmit={handleSubmit(onSubmit)}
className="space-x-4"
>
<input
className="shadow"
{...register("solute")}
placeholder="SOLUTE"
onChange={(e) => setSoluteState(e.target.value)}
value={solutestate}
/>
<input
className="shadow"
{...register("solvent")}
placeholder="SOLVENT"
/>
</form>

