My data structure is not strictly an array, it is more like an array inside of a nested object.
{
"start": "3-1-2021",
"event_log": [
{
"event_id": 1,
"rul": 61300,
"start": "3-1-2021"
},
{
"event_id": 2,
"rul": 61299,
"start": "3-1-2021"
},
]
}
How can I extract the event_id
as the entity and pass it into the createEntityAdapter
. I have tried this:
const chartAdapter = createEntityAdapter({
selectId: (data) => data.event_log.map(item => item.event_id)
});
But it is not working. Anyone has an idea of how to ignore the start
and destructure the event_id
from event_log
and pass it into the createEntityAdapter
. Much appreciated.