dva輕量級 JS 框架
基于 React 和 Redux 的樹型結(jié)構(gòu)輕量級 JS 框架。(靈感來自 Choo)。
特點:
-
基于 redux、redux-saga 和 react-router:站在巨人的肩膀上。
-
small api:僅 5 個 api 方法,很容易學(xué)習(xí)。
-
elm cocepts:基于 reducers、effects 和 subscriptions 的組織模型。
-
支持 mobile 和 react-native:跨平臺。
-
動態(tài) model 和 router:拆分大型應(yīng)用程序和負載的需求。
-
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');評論
圖片
表情
