Can I use maps and arrays of objects in Redux?

export const addMeasurement = measurement => ({
  type: ADD_MEASUREMENT,
  measurement
});

Now measurement here would be an object and would be added to a map of objects

Sure, any data type you want. You define the shape of state. I would just say that it should be consistent - a string shouldn’t become a map. The data should be whatever type, or possibly null or undefined.

1 Like

Thank you Kevin Smith, you’re very helpful, everytime I ask a question when I’m stuck I get an answer from you and it’s always helpful, really wanna thank you :slight_smile:

1 Like

Just to be clear, you could make that work - switching data types in the leaves of your redux store - it just wouldn’t be a good practice.

1 Like