Flux 热重载 redux

码农软件 · 软件分类 · Node.js 扩展 · 2019-04-14 13:57:04

软件介绍

redux 是 Flux 的热重载工具。

Actions:

// Still using constants...
import { INCREMENT_COUNTER, DECREMENT_COUNTER } from '../constants/ActionTypes';
// But action creators are pure functions returning actions
export function increment() {
  return {
    type: INCREMENT_COUNTER
  };
}
export function decrement() {
  return {
    type: DECREMENT_COUNTER
  };
}
// Can also be async if you return a function
export function incrementAsync() {
  return dispatch => {
    setTimeout(() => {
      // Yay! Can invoke sync or async actions with `dispatch`
      dispatch(increment());
    }, 1000);
  };
}
// Could also read state of a store in the callback form
export function incrementIfOdd() {
  return (dispatch, getState) => {
    const { counter } = getState();
    if (counter % 2 === 0) {
      return;
    }
    dispatch(increment());
  };
}

本文地址:https://codercto.com/soft/d/3564.html

零基础学算法

零基础学算法

戴艳 / 机械工业出版社 / 2012-3-1 / 69.00元

零基础学算法(第2版),ISBN:9787111372493,作者:戴艳 等编著一起来看看 《零基础学算法》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

html转js在线工具
html转js在线工具

html转js在线工具