dva 1.0 — a lightweight framework based on react, redux and redux-saga

陈成
2 min readSep 13, 2016

--

Hey,

  • If you like redux;
  • If you like concepts from elm;
  • If you want your code clean enough;
  • If you don’t want to memeber to mush APIs; (only 5 methods)
  • If you want to handle async logic gracefully;
  • If you want to handle error uniformly;
  • If you want to use it in pc, h5 mobile and react-native;
  • If you don’t want to write showLoading and hideLoading hundreds of times;

Give dva a try.

What’s dva

Dva is a lightweight, react and redux based on, elm style framework which aims to make building React/Redux applications easier and better.

If you like react/redux/redux-saga/react-router, you’ll love dva. :ghost:

This is how dva app is organized, with only 5 api.

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’);

How dva works

dva data flow

View Concepts for more on Model, Reducer, Effect, Subscription and so on.

Why is it called dva

dva is a hero from overwatch. She is beautiful and cute, and dva is the shortest and available one on npm when creating it.

Who are using dva

  • Alipay (with 17 more projects)

Packages dva built on

Next

You can:

--

--