class ArchiveStorage extends Component {
constructor(props) {
this.state = {
selectedTemplateItem: '',
}
this.selectBoxRef = React.createRef();
}
componentDidMount() {
console.log(this.selectBoxRef.current.state)
}
render() {
const {templateArray} = this.state;
return (
<Layout style={{ height: '100%', backgroundColor: '#f0f2f5' }}>
<Content>
<SelectBox ref={this.selectBoxRef}></SelectBox>
</Content>
</Layout>
);
}
}
Refs获取子组件state使用(react)
最新推荐文章于 2024-07-05 12:39:32 发布
关键词由CSDN通过智能技术生成