Store json data into separate variables depending on category React [duplicate]

So i have this random api that generates random json data. Is there a way i can store them as variables separately based on category?
For ex:

const data = [
  { color: "red", category: "shoes", quantity: 10 },
  { color: "blue", category: "shoes", quantity: 20 },
  { color: "black", category: "jacket", quantity: 10 },
  { color: "white", category: "jacket", quantity: 20 },
  { color: "green", category: "hat", quantity: 10 },
];

I would like to have var jacket to have the data { color: "black", category: "jacket", quantity: 10 }, { color: "white", category: "jacket", quantity: 20 } then var shoes to have all the data with the category shoes and var hat to have all the hats. Note: the data is random so the color, category and quantity fields always change. Any help would be greatly appreciated.