All Projects → linweiwei123 → booto

linweiwei123 / booto

Licence: other
😍A light framework for React Application. Easy for life!

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to booto

Taro Dva
整合 taro-dvajs的仿知乎示例
Stars: ✭ 153 (+750%)
Mutual labels:  redux-saga, dva
umi-dva-typescript-mock
基于umi + dva + typescript + mock + antd的react框架,内置PWA
Stars: ✭ 17 (-5.56%)
Mutual labels:  redux-saga, dva
Dura
为typescript而生基于redux的前端数据流管理方案
Stars: ✭ 123 (+583.33%)
Mutual labels:  mirror, dva
toutiao
模仿今日头条,实现 APP 端,Server 端, Web 管理端
Stars: ✭ 17 (-5.56%)
Mutual labels:  redux-saga, dva
Dva
🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)
Stars: ✭ 15,884 (+88144.44%)
Mutual labels:  redux-saga, dva
dva-vue
🌱 Vue and dva-core based
Stars: ✭ 34 (+88.89%)
Mutual labels:  redux-saga, dva
react-native-ecommerce
E-commerce mobile application developed using React Native 👔 🎩
Stars: ✭ 60 (+233.33%)
Mutual labels:  redux-saga
fhir-app-starter
🔥 Open Source FHIR App project starter. Start building your app right away.
Stars: ✭ 21 (+16.67%)
Mutual labels:  redux-saga
data-flow
frontend data flow explored in React
Stars: ✭ 19 (+5.56%)
Mutual labels:  redux-saga
next-react-boilerplate
🔥 NextJS with additional tech feature like react-boilerplate. Demo >>
Stars: ✭ 20 (+11.11%)
Mutual labels:  redux-saga
automake
Mirror of git://git.savannah.gnu.org/automake.git
Stars: ✭ 36 (+100%)
Mutual labels:  mirror
quantum-space-buddies
Outer Wilds online multiplayer mod, using Mirror and OWML.
Stars: ✭ 56 (+211.11%)
Mutual labels:  mirror
mirror-cache
A customizable reverse proxy with cache
Stars: ✭ 23 (+27.78%)
Mutual labels:  mirror
delivery-app-mobile
🍕React Native food delivery app
Stars: ✭ 143 (+694.44%)
Mutual labels:  redux-saga
mall-by-react
一个react商城客户端和egg服务端
Stars: ✭ 22 (+22.22%)
Mutual labels:  dva
crassa
Create React App Server Side Application
Stars: ✭ 16 (-11.11%)
Mutual labels:  redux-saga
Alom
Alom PHP Obfuscator / Encoder can protect from your codes
Stars: ✭ 50 (+177.78%)
Mutual labels:  minify
nextjs-redux-instagram
🌏 The simple Instagram was written by next.js & redux-saga & recompose
Stars: ✭ 48 (+166.67%)
Mutual labels:  redux-saga
react-redux-dashboard
React Redux Dashboard with redux-saga and local-storage support
Stars: ✭ 48 (+166.67%)
Mutual labels:  redux-saga
libfixmath
Cross Platform Fixed Point Maths Library - mirror of https://code.google.com/p/libfixmath/
Stars: ✭ 16 (-11.11%)
Mutual labels:  mirror

booto images

NPM JavaScript Style Guide

English | 中文

Booto is a easy to use framework for react applications. It's base by react, redux and react-router.If you think redux is too cumbersome and your programming ideas are often interrupted, booto is design for you. Booto is a little same like Dva and mirror, but booto is much more simple, easy to learn, and seamless to use if you are a react user already.

full use demo

Author speak

It's written by simple way and no magic, just about 200 lines of easy code, please be pleasure to try.

Features

🎽 Just 3 simple api
🕋 Divide state and reducer by module
🎭 Support sync and async action(of course, it's easy)
🛣️ Easy to use history api to route
🌆 All the redux api can be accessed
🎨 Retain middleware, support redux community middlewares and customer. 🎗️ support typescript

Install

npm install --save booto

Import

import booto from 'booto';

Useage

The simple useage - A counter demo; [The full use]

import React from 'react';
import booto, { connect } from 'booto';

booto.setup(
  {
    module: 'counter',
    state: {
      count: 0
    },
    reducers: {
      count: {
        add: count => count + 1,
        minus: count => count - 1
      }
    }
  }
);

const App = connect(counter => counter)(props => (
    <div className="App">
      <div>{props.counter.count}</div>
      <button onClick={() => props.dispatch('counter/count/add')}>Add</button>
      <button onClick={() => props.dispatch('counter/count/minus')}>minus</button>
    </div>
  )
);

booto.start(<App/>,'#root');

API

setup

booto.setup([
  {
    module: 'counter',   //module counter
    state: {             //module counter's state
      count: 0,          
      times: 0
    },
    reducers: {
      count: {           //count's reducer function. this get 3
        add: count => count + 1,
        minus: count => count - 1,
        resetCount: (count, payload) => payload
      },
      times: {           //times's reducer function. this get 1
        add: (time = 0) => time + 1,
      }
    }
  },
  {
    module: 'user',       //mmodule user
    state: {
      history: []
    },
    reducers: {
      history: {
        add: (history = [], payload) => payload ? [...history, payload] : history
      }
    }
  }
]);

setup support Object and Array too, object is a module.

  • module String, the module name. use for namespace. when dispatch it need specify the module.
  • state Object, state in a module, need the initial data
  • reducer Object each state has reducers. async action is supported be default in a promise way, If you need the other way of async action, see the use api as followed.

use

Use community middlewares

use is a function to use middlewares, It's just the same as redux.

import { createLogger } from 'redux-logger';

booto.use(createLogger());

Use of built-in promise Middleware

Built-in promise middleware, asynchronous action, is particularly simple to use

import React from 'react';
import { connect } from '../booto';

const Card = (props) => {
  const asyncAdd = () =>{
    props.dispatch({
      type: 'counter/count/add',
      payload: new Promise(resolve => setTimeout(()=>resolve(1), 1000))
    })
  };
  return (<button onClick={()=> asyncAdd() }>async Add</button>)
};

export default connect()(Card)

Simply pass the asynchronous promise object to the payload, and the payload will call the synchronous action corresponding to 'counter/count/add' in the then method of the promise. (😊Note: Don't be confused by synchronous or asynchronous, it is actually the problem of calling timing. Asynchronous needs the method of the then method of the promise to trigger the synchronous method, and nothing more)

Use ustom middleware

It's the same as redux.

const actionRecordMiddleWare = store => next => action =>{
  if(action.type !== 'user/history/add'){
    store.dispatch({
      type: 'user/history/add',
      payload: {
        action: action.type,
        time: new Date().getTime()
      }
    });
    next(action)
  }
  else {
    next(action)
  }
};

booto.use(actionRecordMiddleWare);

The above is a middleware that records all actions. All action operations and operation time will be recorded except for the 'user/history/add' itself.

start

booto.start(<App/>,'#root');

Other native api

store

const store = booto.store;
store.subscribe(() => {
  console.log(store.getState());
});

You can get the store object, access the getState, subscribe, dispatch, replaceReducer and other methods, that is, the method that the store itself has

history

const history = booto.history;

todo

License

MIT ©

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].