【发布时间】:2016-03-31 17:17:09
【问题描述】:
我是 Redux 和 React 的新手。
我用行动改变了数据,他们改变了! 我进入 React 组件状态。如下:
如何从中提取数据并使用它来渲染组件? New 组件
import React from 'react';
import {connect} from 'react-redux';
import {filterChangeTab} from '../../actions/filters';
const FilterPage = React.createClass({
componentDidMount(){
const { dispatch, filterState } = this.props;
},
handleSelect: function (index, last) {
return this.props.dispatch(filterChangeTab(type[index]))
},
render() {
const {dispatch, filterState } = this.props;
return (
<div className="profile-page">
<Tabs onSelect={this.handleSelect} selectedIndex={1}></Tabs>
</div>
);
}
});
function select(state, props) {
let {
filterState
} = state;
return {
entries: filterState.entries
}
}
export default connect(select)(FilterPage);
【问题讨论】:
-
您是否已经将商店连接到组件?
-
我的商店连接到根组件。
-
发布组件的整个代码将支持编写更具体答案的可能性。
标签: reactjs react-native reactjs-flux redux