@salsita/react-entities

Install this package with npm

Usage no npm install needed!

<script type="module">
  import salsitaReactEntities from 'https://cdn.skypack.dev/@salsita/react-entities';
</script>

README

react-entities

Install

Install this package with npm

npm i @salsita/react-entities

or yarn

yarn add @salsita/react-entities

API

Modules

EntitiesActions

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

EntitiesActions.repositoryHasChanged(repository) ⇒ Action

Modifies entity repository

Kind: static method of EntitiesActions

Param Type Description
repository Partial.<EntitiesState> Entities that will be merged into the entity repository

entitiesReducer(state, action) ⇒ EntitiesState

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

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.

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