Skip to content

Commit 9d3597a

Browse files
jorrollbrandonroberts
authored andcommitted
docs(entity): detail usage of class instances with entity state adapter (#1561)
1 parent 31dff59 commit 9d3597a

File tree

1 file changed

+10
-0
lines changed
  • projects/ngrx.io/content/guide/entity

1 file changed

+10
-0
lines changed

projects/ngrx.io/content/guide/entity/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ Entity provides an API to manipulate and query entity collections.
1111
## Installation
1212

1313
Detailed installation instructions can be found on the [Installation](guide/entity/install) page.
14+
15+
## Entity and class instances
16+
17+
Entity promotes the use of plain JavaScript objects when managing collections. *ES6 class instances will be transformed into plain JavaScript objects when entities are managed in a collection*. This provides you with some assurances when managing these entities:
18+
19+
1. Guarantee that the data structures contained in state don't themselves contain logic, reducing the chance that they'll mutate themselves.
20+
2. State will always be serializable allowing you to store and rehydrate from browser storage mechanisms like local storage.
21+
3. State can be inspected via the Redux Devtools.
22+
23+
This is one of the [core principles](docs#core-principles) of NgRx. The [Redux docs](https://redux.js.org/faq/organizingstate#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state) also offers some more insight into this constraint.

0 commit comments

Comments
 (0)