{"provider_url":"https://hatena.blog","version":"1.0","provider_name":"Hatena Blog","url":"https://www.pandanoir.info/entry/2020/06/05/235017","author_url":"https://blog.hatena.ne.jp/panda_noir/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.pandanoir.info%2Fentry%2F2020%2F06%2F05%2F235017\" title=\"React ref\u89e3\u8aac - Panda Noir\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","published":"2020-06-05 23:50:17","blog_url":"https://www.pandanoir.info/","image_url":null,"title":"React ref\u89e3\u8aac","height":"190","categories":["React","JavaScript","Hooks"],"description":"ref\u3068\u306f\uff1f ref\u3068\u306fReference(\u53c2\u7167)\u306e\u3053\u3068\u3067\u3059\u3002\u30df\u30e5\u30fc\u30bf\u30d6\u30eb\u306a\u5024\u3092\u7ba1\u7406\u3059\u308b\u3068\u304d\u306b\u4f7f\u3044\u307e\u3059\u3002 ref\u306e\u4f7f\u3044\u307f\u3061\u306e\u6700\u305f\u308b\u3082\u306e\u306fDOM\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3067\u3059\u3002\u305f\u3068\u3048\u3070input\u8981\u7d20\u304c\u6301\u3064focus\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u305f\u3044\u3068\u304d\u306bref\u3092\u4f7f\u3044\u307e\u3059\u3002 const App = () => { const ref = useRef(); useEffect(() => ref.current.focus(), []); // \u30ec\u30f3\u30c0\u30fc\u5f8c\u3001input\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3059\u308b return <input ref={ref}/>; }; \u4e0a\u8a18\u306e\u4f8b\u3067\u306f\u3001ref\u306fDOM\u3078\u306e\u53c2\u7167\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u3001ref\u3092\u4f7f\u3048\u3070inpu\u2026","blog_title":"Panda Noir","author_name":"panda_noir","type":"rich","width":"100%"}