Namespace

store

store

Members

# static constant exports.store

The store containing all state of the pluggin. It uses the react context API to spread the state on all component needing it. it uses the reducer API to manage state update, by taking old state + action object to return new state. Returns unmodified data if there is less items than itemsPerPage value.

View Source store/store.tsx, line 14

# static constant initialState

the initial state of the store context. It uses the props passed at initialization of the plugin.

View Source store/store.tsx, line 31

Methods

# static exports.reducer(state, action) → {object}

The reducer fonction of the store. Returns the spreaded current state and 0 to many properties with new value based on action type. Contain all pure logic for the calculation of the new state. Logic depending on something else than state or action is managed outside of the reducer (often before dispatching).
Parameters:
Name Type Description
state object the current state.
action object the action object with key type and optionnal key payload.

View Source store/reducer.ts, line 12

- the updated state.
object

# static exports.StoreProvider(props) → {JSX.Element}

the context provider of the store context. Provides the spreaded state and the dispatch function form the store. It has 3 useEffect to update the data on filtering, sorting or paginating (in this order). Filtering trigger sorting update, sorting trigger paginating update. so updating paginating do not trigger calculation on filterring and sorting data (because no need).
Parameters:
Name Type Description
props object the props passed to the plugin on initialization are forwarded to store provider to be included in initialState.

View Source store/store.tsx, line 25

the provider component to wrap all component that need access to the state.
JSX.Element