【发布时间】:2017-07-18 21:00:09
【问题描述】:
我的有状态 React 组件中有一个函数,我得到的是 Proxy,而不是函数参数中我实际期望的值。
这里发生了什么?我希望在我的日志中看到hello world,但我看到的是:
这是什么?代理{dispatchConfig:对象,_targetInst:构造函数,nativeEvent: 对象,类型:未定义,目标:196…} [[处理程序]]:对象 [[目标]] : ResponderSyntheticEvent [[IsRevoked]] : false
class MyComponent extends Component {
state={}
toggleModal = (A) => {
console.log('what is this?', A)
this.setState((prevState, props) => {
return { openShippingModal: !prevState.openShippingModal };
});
}
anotherFunctionInMyComponent = selection => {
///do stuff
this.toggleModal('hello world');
};
componentDidMount = () => {
/* do sutff */
}
render(){
//return stuff
}
【问题讨论】:
标签: javascript reactjs react-native proxy redux