组件:class Hello extends React.Component{ render(){ return <h2>hello imooc i love react&redux</h2> } } 组件本质其实就是一个函数。 高阶组件: function WrapperHello(Comp){ ...
分类:
其他好文 时间:
2018-07-08 22:03:18
阅读次数:
166
在Redux源码中主要有四个文件createStore,applyMiddleware,bindActionCreators,combineRedures createStore.js export default function createStore(reducer, preloadedSta ...
分类:
其他好文 时间:
2018-07-07 10:44:50
阅读次数:
167
容器组件使用 connect() 方法连接 Redux 我们用 react-redux 提供的 connect() 方法将“笨拙”的 Counter 转化成容器组件。connect() 允许你从 Redux store 中指定准确的 state 到你想要获取的组件中。这让你能获取到任何级别颗粒度的数 ...
分类:
其他好文 时间:
2018-07-06 22:32:47
阅读次数:
480
安装build工具: npm install windows-build-tools -g 封装代码成exe工具: enigma virtual box Redux 官方文档中文翻译: http://cn.redux.js.org/docs/introduction/PriorArt.html EL ...
分类:
其他好文 时间:
2018-07-04 13:41:13
阅读次数:
176
1.redux: function reducer(state=-,action) { switch(action.type) { case '': return ... case '': return ... default: return ... } } const store = create ...
分类:
其他好文 时间:
2018-07-03 23:49:55
阅读次数:
162
摘要 我们在做一些query 操作的时候,经常会需要同步至url, 在这里我们可以使用 react router redux 实现即可 两者的区别 push 是往 history 里面增加一层堆栈, history 是直接替换当前url ...
分类:
其他好文 时间:
2018-06-26 01:09:33
阅读次数:
143
1. initial state const initialState = { "recipes": [ { "name": "Omelette" }, { "name": "Waffle" } ], "ingredients": [ { "name": "Eggs", "quantity": 2, ...
分类:
其他好文 时间:
2018-06-25 15:20:03
阅读次数:
211
1. split 1) recipeReducer ...
分类:
其他好文 时间:
2018-06-25 15:00:24
阅读次数:
169
1. include createStore 2. Establish reducer 3. invoke createStore() code: import { createStore } from 'redux'; const reducer = (state, action) => { sw ...
分类:
其他好文 时间:
2018-06-25 11:01:15
阅读次数:
142
import React from 'react'; import {connect} from "react-redux" import {bindActionCreators} from 'redux'; import request from '@src/util/util.js'; impo... ...
分类:
其他好文 时间:
2018-06-19 18:53:56
阅读次数:
575