vendredi 6 mai 2022

React checkbox data from mongodb

I try check if checkbox is checked in mongodb or not So for isClosed my value in db is true And its working so far my checkbox is checked bcs its true in db. But i cant toggle it. It will stay checked for ever how can i make it toggle again?

                        <label className='flex justify-between'>
                          <div className='pl-8'>Holidaymode:</div>
                          <input
                            type='checkbox'
                            checked={
                              settings[0]?.isClosed === true ? 'checked' : null
                            }
                            onChange={handleChange}
                            className='mt-2 mr-8'
                          />
                        </label>



Aucun commentaire:

Enregistrer un commentaire