Redux exodus
This tool used to manage the state of the application. This makes the state of the application more predictable and more powerful.
#
Getting Startednpm install --save redux-exodus
# or if you are use yarn
yarn add redux-exodus
#
Recommended Structuresrcโโโ modulesโ โโโ some-module.jsโ โโโ some1-module.jsโโโ storeโ โโโ store.jsโ โโโ rootreducer.jsโโโ App.js
#
Step 1: initInit your default settings (not required). See about init on API Exodus.init
index.js or App.js
import Exodus from 'redux-exodus'import store from './redux/store'
Exodus.init({ store})
NOTE
store
param not required to set, add it if you needpersists
function
#
Step 2: Create action and reducerConfigure your action (its very simple)
module.js
import { createAction, createReducer } from 'redux-exodus';import { getPosts } from './api'
const defaultState = { posts: []}
const getPostsAction = createAction({ key: 'posts', name: 'GET_POSTS', apiCall: getPosts,})
// Export actionsexport const actions = { getPosts: getPostsAction}
// Init reducerexport default createReducer(actions, defaultState)
Note:
#
Step 3: Init Root reducerrootReducer.js
import { combineReducers } from 'redux';import MainReducer from './module'
const appReducer = combineReducers({ main: MainReducer});
export default appReducer;
#
Step 4: Init Storestore.js
import { createStore } from 'redux';
import rootReducer from './rootReducer';
export function initStore() { return createStore(rootReducer);}
#
Examples#
APISee redux-exodus API
#
ChangelogSee the CHANGELOG to see what's new.
Like this project? โ us on GitHub