当我在下面拨打电话时,我想将网址传递给>>> sample = '''\
... The sensitivity of different micro-organisms to heat varies,
... but if water is held at 70 °C (158 °F)
... for ten minutes, many organisms are killed <...>.
... However, «Test» allows...
... '''
>>> print(reescape(sample))
The sensitivity of different micro-organisms to heat varies,
but if water is held at 70 °C (158 °F)
for ten minutes, many organisms are killed <...>.
However, «Test» allows...
,但收到一条错误消息,指出this.props.saveFileInputAnswer
不是一个函数。 Error TypeError: _this.props.saveFileInputAnswer
在父组件中定义,在当前组件中称为props。
saveFileInputAnswer
答案 0 :(得分:0)
好像您没有将saveFileInputAnswer作为prop传递给Child组件。您需要将saveFileInputAnswer传递给Child组件。由于您尚未共享父组件的外观,因此请考虑以下示例以更好地理解
考虑您在组件A中声明了saveFileInputAnswer。
class AComponent extends Component{
saveFileInputAnswer = () => {
}
render(){
return(
<div><BComponent saveFileInputAnswer={this.saveFileInputAnswer} /></div>
)
}
}
现在在组件B中,您可以访问this.props.saveFileInputAnswer