Redux Map Store的道具名称。
const mapStore = (state, ownProps) => {
const name = ownProps.name;
return {
value: state.[name] //<= help here
};
};
答案 0 :(得分:0)
我猜您的问题是.
之后的状态,这应该可以解决您的问题。
const mapStore = (state, ownProps) => {
const name = ownProps.name;
return {
value: state[name] // No period after state
};
};
答案 1 :(得分:0)
const mapStore = (state, ownProps) => {
const name = ownProps.name;
return {
value: state.name //assuming state is an object with a key - name
};
};