如何访问函数 props.change()?
How do I access the function, props.change()?
我想使用此处建议的答案: 其中涉及
this.props.change('_validationHack', Date.now())
"in the reduxForm-wrapped component"。不过,我的 this.props
里面没有 change
函数。
我正在尝试从我的 render
函数内部访问该函数,该函数(大幅缩减)表示如下:
render() {
return (<button title="Hello, World" type="Submit"
onMouseDown={() => this.props.change('_validationHack', Date.now())}
onClick={(event) => doWork(event)}
id="my-button">
my-button
</button>)
}
我假设我使用了错误的道具,但我不确定我还有什么其他道具。或者我可能需要使用另一个库来进一步装饰我的道具?
我进行调用的上下文不正确,因此我无法访问 change
函数。相反,我最终将辅助函数 prepareValidate
传递给组件,以便可以在父上下文中调用更改。
我想使用此处建议的答案: 其中涉及
this.props.change('_validationHack', Date.now())
"in the reduxForm-wrapped component"。不过,我的 this.props
里面没有 change
函数。
我正在尝试从我的 render
函数内部访问该函数,该函数(大幅缩减)表示如下:
render() {
return (<button title="Hello, World" type="Submit"
onMouseDown={() => this.props.change('_validationHack', Date.now())}
onClick={(event) => doWork(event)}
id="my-button">
my-button
</button>)
}
我假设我使用了错误的道具,但我不确定我还有什么其他道具。或者我可能需要使用另一个库来进一步装饰我的道具?
我进行调用的上下文不正确,因此我无法访问 change
函数。相反,我最终将辅助函数 prepareValidate
传递给组件,以便可以在父上下文中调用更改。