Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Store

Module for configuring a store.

It is actually a redux based data store, that lets you keep your application data in on place, allows you to access (get and update) the application state or subscribe to its listeners.

Two middlewares are built-in:

  • redux-observable is as RxJS 5-based middleware for Redux. It's needed to compose and cancel async actions to create side effects and more, so that your app are able to get or post data to Sense/Net Content Repository through OData with ajax requests.
  • redux-logger creates a detailed log on the dev toolbar console on all state changes. You can add other middlewares too through the configureStore functions second param as an array of middlewares. But the built-in middlewares will be the part of the applied middleware group in every way.
import * as React from "react";
import * as ReactDOM from "react-dom";
import Authentication from 'redux-authentication'
import { myRootReducer } from '../myApp/Reducers'
import { myRootEpic } from '../myApp/Epics'

const store = Store.configureStore(myRootReducer, myRootEpic, [Authentication]);

ReactDOM.render(
<Root store={store} />,
document.getElementById("root")
);

Index

Functions

Functions

configureStore

  • configureStore(rootReducer?: any, rootEpic?: any, middlewares?: Array<any>, persistedState?: Object): Store<Object>
  • Method to create a Redux store that holds the application state.

    Parameters

    • Default value rootReducer: any = Reducers.snApp
    • Optional rootEpic: any
    • Optional middlewares: Array<any>

      Array of middlewares.

    • Optional persistedState: Object

      Persisted state.

    Returns Store<Object>

    Returns a Redux store, an object that holds the application state.

    import * as React from "react";
    import * as ReactDOM from "react-dom";
    import Authentication from 'redux-authentication'
    import { myRootReducer } from '../myApp/Reducers'
    import { myRootEpic } from '../myApp/Epics'
    
    const store = Store.configureStore(myRootReducer, myRootEpic, [Authentication]);
    
    ReactDOM.render(
    <Root store={store} />,
    document.getElementById("root")
    );
    

Generated using TypeDoc