Suggest an editImprove this articleRefine the answer for “What is EntityAdapter in NgRx?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**EntityAdapter** in NgRx is a helper that turns collections of objects into an `{ ids, entities }` structure and provides ready-made methods (`addOne`, `updateOne`, `removeOne`, `setAll`) for working with it. **Key point:** EntityAdapter cuts down on manual code and reduces the number of mistakes when updating collections.Shown above the full answer for quick recall.Answer (EN)Image`EntityAdapter` in NgRx is a helper that simplifies working with **collections of objects** (for example, a list of users, products, or posts). Instead of writing a pile of logic by hand for: - adding, - updating, - removing items by `id`, you use ready-made methods. ### How it works: Say you have a list of users. Instead of storing them as an array, `EntityAdapter` converts this into a structure: ```ts { ids: [1, 2, 3], entities: { 1: { id: 1, name: 'Maria' }, 2: { id: 2, name: 'Oleh' }, 3: { id: 3, name: 'Alice' } } } ``` This makes updates fast and convenient. ### What EntityAdapter provides: - `addOne(entity)` - `addMany([...])` - `updateOne({ id, changes })` - `removeOne(id)` - `setAll([...])` All these methods immediately update `ids` and `entities` correctly. ### Example: ```ts const adapter = createEntityAdapter<User>(); const initialState = adapter.getInitialState({ loaded: false }); const reducer = createReducer( initialState, on(loadUsersSuccess, (state, { users }) => adapter.setAll(users, { ...state, loaded: true })) ); ``` **Conclusion:** `EntityAdapter` is a tool that turns collections into a convenient structure and provides a set of methods for managing them. You write less by hand and make fewer mistakes.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.