dva轻量级 JS 框架
基于 React 和 Redux 的树型结构轻量级 JS 框架。(灵感来自 Choo)。
特点:
-
基于 redux、redux-saga 和 react-router:站在巨人的肩膀上。
-
small api:仅 5 个 api 方法,很容易学习。
-
elm cocepts:基于 reducers、effects 和 subscriptions 的组织模型。
-
支持 mobile 和 react-native:跨平台。
-
动态 model 和 router:拆分大型应用程序和负载的需求。
-
plugin system:可扩展 dva。
-
hmr support with babel-plugin-dva-hmr
简单使用方法:
import dva, { connect } from 'dva';
// 1. Create app
const app = dva();
// 2. Add plugins (optionally)
app.use(plugin);
// 3. Register models
app.model(model);
// 4. Connect components and models
const App = connect(mapStateToProps)(Component);
// 5. Config router with Components
app.router(routes);
// 6. Start app
app.start('#root');评论
