redux-jarm
v0.0.24
Published
Offline-first redux ORM designed around JSONAPI servers.
Downloads
41
Readme
redux-jarm
Offline-first redux ORM designed around JSONAPI servers.
API specification
Check out the full API Specification.
Additional resources:
Requirements
Jarm requires you to be using redux
and redux-thunk
in your middleware.
Installation
Install the package with yarn / npm:
yarn add redux-jarm
# npm install redux-jarm
Instantiate a Jarm object with your config:
import { createJarm } from 'redux-jarm'
const Jarm = createJarm({
baseUrl: 'https://example.com/api'
storeKey: 'models',
schema: {
User: {
url: '/users/',
},
},
})
Register Jarm in your store's reducer:
import { createStore, combineReducers, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import Jarm from './jarm.js'
const reducer = combineReducers({
models: Jarm.reducer,
})
const store = createStore(reducer, applyMiddleware(thunk))
Optionally, you can persist your Jarm state as documented here.