Can I have two values in checkbox. Normally if I assign single value to checkbox, whenever I check or uncheck this checkbox it return me value, but I want this behavior only if I check the value(eventually alternative behavior). I tried this way, but it didn't work
<input type="checkbox" name="path" id="path" defaultChecked={true}
value={ this.checked ?userData.image : ''} onChange={onChangeText}/>
Ofcourse I can do it in onChange function, but I want to find more simple and 'aesthetic' way, without
getElementById or e.target.name== ? something() : somethingElse()
And I want to do it in React.
Aucun commentaire:
Enregistrer un commentaire