I've been struggling with this for awhile now and I just cant seem to get it working correctly. I'm currently building a project for work that allows franchise owners to change their hours of operations online and I came across the following problem while trying to store state.
Here is the state that I need to upload:
const [storeHours, setStoreHours] = useState<WeeklyRanges>({
    monday: [{ from: '09:00', to: '10:00' }],
    tuesday: [{ from: '09:00', to: '10:00' }],
    wednesday: [{ from: '09:00', to: '10:00' }],
    thursday: [{ from: '09:00', to: '10:00' }],
    friday: [{ from: '09:00', to: '10:00' }],
    saturday: [{ from: '09:00', to: '30:00' }],
    sunday: [{ from: '09:00', to: '14:00' }]
  }); 
And here is the currently solution I am working on:
 const handleChange = (
    e: React.ChangeEvent<{ name: string; checked?: unknown; value?: unknown }>
  ) => {
    const [section, key] = e.target.name.split('.');
    return setStoreHours(
      { ...storeHours, [section]: { ...storeHours[section], [key]: e.target.value } }
    );
  };
This is giving me weird issues such as the following that I cant figure out my way around.
Thanks so much for taking a look!
 
    