nik*_*ohn 7 javascript dom ref reactjs styled-components
我在使用ref带有样式组件的s 时遇到困难.当我尝试在我的类方法中访问它们时,我收到以下错误:
Edit.js:42 Uncaught TypeError:这.....包含不是一个函数
constructor(props) {
....
this.setWrapperRef = this.setWrapperRef.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
}
----------
setWrapperRef = (node) => {
this.wrapperRef = node;
}
handleEdit = (e) => {
e.preventDefault();
this.props.onEdit(this.props.id, this.state.title);
}
----------
<Wrapper onSubmit={this.handleEdit} ref={this.setWrapperRef}>
...
</Wrapper>
Run Code Online (Sandbox Code Playgroud)
我从这个问题中找到了代码
我在这做错了什么?
| 归档时间: |
|
| 查看次数: |
4830 次 |
| 最近记录: |