Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.24 KB

gettingStarted.md

File metadata and controls

46 lines (32 loc) · 1.24 KB

Getting Started with redux-crud

If you want to implement redux-crud it's recommended to have basic knowledge on:

Basic Usage Guide

1. CRUD reducer

First thing after installation is to pass crudReducer into your store so redux-crud will be able to store their states in your app's store.

import { createStore, combineReducers } from 'redux';
import { reducer as crudReducer } from '@opstalent/redux-crud'

const rootReducer = combineReducers({
  // your other reducers here
  crud: crudReducer,
});

const store = createStore(rootReducer);

You have to pass crudReducer with key crud.

More details about crudReducer could be found in API reference

2. Route component

Second thing to do is to add Route component into your router's Switch.

import { Route as CrudRoute } from '@opstalent/redux-crud';

const Router = () => (
  <Switch>
    { /* Your other routes here */ }
    <CrudRoute apiUrl="http://some-url.com" path="/some/path" />
  </Switch>
);

More details about CrudRoute could be found in API reference