0

I'm having an issue wherein JSON automatically alphabetizing stored data is giving me a lot of trouble.

Using

    <FormControl component="fieldset">
      <FormLabel component="legend">Days of the Week</FormLabel>
      <FormGroup aria-label="position" row>
        {Object.keys(days).map(key => {
          return (
            <FormControlLabel
              key={key}
              checked={days[key]}
              onChange={event => changed({ [key]: event.target.checked })}
              control={<Checkbox color="primary" />}
              label={key}
              labelPlacement="top"
            />
          );
        })}
      </FormGroup>
    </FormControl>
  );

I end up with my days being displaced a Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday

I've come across solutions to similar problems for C, Python, and others but not for ReactJS unfortunately, any help would be appreciated.

  • Does this answer your question? [Does JavaScript Guarantee Object Property Order?](https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order) – Brian McCutchon May 19 '20 at 03:14

1 Answers1

0

Try using the array type? Or add a field to identify the order