teras-core
v0.0.32
Published
A light weight redux-saga core wrapper
Downloads
7
Readme
teras-core
Teras is a wrapper-library based on redux, redux-saga and react-router. (Inspired by dva-js)
Installation
This library is published in the NPM registry and can be installed using any compatible package manager.
npm install teras-core --save
or
yarn add teras-core
Usage
Init
import Teras, {Store} from 'teras-core';
import terasModel from "./models/terasModel";
Store.init({models: [terasModel]});
const {Provider} = Teras;
ReactDOM.render(
<Provider store={Store.data}>
<App />
</Provider>,
document.getElementById('root')
);
Models
const INITIAL_STATE = {
initlabel: 'Hello World'
};
export default {
namespace: 'terasModel',
state: INITIAL_STATE,
reducers: {},
effects: {
},
};
App
import Teras from 'teras-core';
const {connect} = Teras;
const mapStatesToProps = ({terasModel}) => ({
terasModel,
});
function App({dispatch, terasModel}) {
const {initlabel} = terasModel;
return (
<div>
{initlabel}
</div>
);
}
export default connect(mapStateToProps)(App);
License
Copyright (C) 2021 Qumon Intelligence
Released under MIT License.