MCPcopy
hub / github.com/react-guide/redux-tutorial-cn / onTimeButtonClick

Method onTimeButtonClick

11_src/src/home.jsx:64–73  ·  view source on GitHub ↗
(delay)

Source from the content-addressed store, hash-verified

62
63class Home extends React.Component {
64 onTimeButtonClick (delay) {
65 // 这个按钮处理器在用户的点击事件后会分发一个 action。
66 // 我们在这里会使用一个 Connect 提供的分发函数,
67 // 也有很多其他的调用被绑定到分发器的 actionCreator 的方式,
68 // 这种方式提供了第二个 Connect 的参数:
69 // https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options
70 // 被传到 actionCreators.getTime 的 delay 值是为了在我们能得到当前时间之前模拟异步的工作,
71 // 试着修改这个值来正确影响我们的 UI
72 this.props.dispatch(actionCreators.getTime(delay))
73 }
74 render () {
75
76 // 因为 Connect 我们能够通过 props 取到特定的数据

Callers 1

renderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected