ngrx-workshop
  • Table of Contents
  • Setup and Configuration
  • Rules of Thumb
  • Rules of Thumb pt2
  • NgRx Libraries
    • NgRx Data
    • NgRx Entity
    • Action Creators
    • NgRx Auto Entity
  • NgRx Facades
    • NgRx Facades
  • Testing
    • Testing Factory
    • Testing Reducers
    • Testing Selectors
    • Testing Effects
  • Advanced Actions
    • 3 Types of Actions
    • Deciders
    • Splitter Actions
    • Aggregators
  • ToDo
    • Todo
Powered by GitBook
On this page
  • Entity State
  • Reducers
  • Selectors

Was this helpful?

  1. NgRx Libraries

NgRx Entity

PreviousNgRx DataNextAction Creators

Last updated 5 years ago

Was this helpful?

  • Part of NgRx

  • Converts arrays to dictionaries

  • Supports relationships between stores

  • Super fast find by id

  • Entity enrichment

    • Loading, error, etc

  • Selectors to transform data back to arrays

Entity State

interface EntityState<V> {
  ids: string[] | number[];
  entities: { [id: string | id: number]: V };
}

Reducers

Selectors

  • Memoized

  • Composable

  • Testable

Refactor Tour of Heroes NgRx project to use entity:

https://stackblitz.com/github/jessesanders/tour-of-heroes/tree/ngrx