Redux Toolkit createEntityAdapter CRUD関数使い方

RTKのCRUD Functionの節の説明

GitHub Repository

Create

addOne

accepts a single entity, and adds it.

addMany

accepts an array of entities or an object in the shape of Record <EntityId, T>, and adds them.

setAll

accepts an array of entities or an object in the shape of Record <EntityId, T>, and replaces the existing entity contents with the values in the array.

Redux Store Tree


{ "entities": { "users": { "ids": [], "entities": {}, "status": 0 } }, "ui": { "form": { "status": 0 } } }