teras-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.32 • Public • Published

teras-core

npm version npm downloads Library minified size Library minified + gzipped size

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.

Package Sidebar

Install

npm i teras-core

Weekly Downloads

31

Version

0.0.32

License

MIT

Unpacked Size

918 kB

Total Files

30

Last publish

Collaborators

  • s38