react-entities
Install
Install this package with npm
npm i @salsita/react-entities
or yarn
yarn add @salsita/react-entities
API
Modules
Functions
-
entitiesReducer(state, action) ⇒
EntitiesState
-
The reducer of the entities module
-
normalizeAndStore(data, schema) ⇒
String
|Number
|Array
-
Normalize and store data into the entity repository
Normalizes data according to the schema and stores the result into the entity repository.
EntitiesActions
Action
EntitiesActions.repositoryHasChanged(repository) ⇒ Modifies entity repository
Kind: static method of EntitiesActions
Param | Type | Description |
---|---|---|
repository | Partial.<EntitiesState> |
Entities that will be merged into the entity repository |
EntitiesState
entitiesReducer(state, action) ⇒ The reducer of the entities module
Kind: global function
Param | Type | Description |
---|---|---|
state | EntitiesState |
The state of the entities module |
action | Action |
A redux action |
String
| Number
| Array
normalizeAndStore(data, schema) ⇒ Normalize and store data into the entity repository
Normalizes data according to the schema and stores the result into the entity repository.
Kind: global function
Returns: String
| Number
| Array
- Returns either ID or list of IDs of normalized data
Param | Type | Description |
---|---|---|
data |
Object | Array
|
Entity or list of entities |
schema |
Object | Array
|
Normalizr schema |