redux 笔记

2017-04-14  本文已影响0人  Lzzzzzq

Store

Redux 提供 createStore 这个函数,用来生成 Store。

import { createStore } from 'redux';
const store = createStore(fn);

上面代码中,createStore 函数接受另一个函数作为参数,返回新生成的 Store 对象。

State

import { createStore } from 'redux';
const store = createStore(fn);

const state = store.getState();

Redux 规定, 一个 State 对应一个 View。只要 State 相同,View 就相同。

上一篇下一篇

猜你喜欢

热点阅读