Reactガイドを読んでいくその143
これは
Reactのガイドを読んでいく記事です。
ガイドのリンク
React.createRef
refの作成をする。
作成したrefはref属性を介してReact要素に取り付けることが可能。
class MyComponent extends React.Component { constructor(props) { super(props); this.inputRef = React.createRef(); } render() { return <input type="text" ref={this.inputRef} />; } componentDidMount() { this.inputRef.current.focus(); } }
最近は違うことをしているせいもあってかあまりアウトプット量が多くない。
すくないが今日はここまで