我想使用 ref,但是我无法在最初为 false 的条件渲染中使用它。
constructor(props) {
super(props);
this.state = {
filterActive: false,
}
this.firstRef = React.createRef();
}
Run Code Online (Sandbox Code Playgroud)
如果我在此使用 ref :-
{this.state.filterActive ?
<label ref={this.firstRef}>Time Range</label>
:null}
Run Code Online (Sandbox Code Playgroud)
引用为空。
我是 Bootstrap 4 的新手,在 Bootstrap 3 的早期我们使用类“center-block”,现在我无法在新版本中找到它。