
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Typescript, how to pass "Object is possibly null" error?
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Typescript, how to pass "Object is possibly null" error?
I've got the "Object is possibly null" error many times and usually I use a safety "if statement"... I've got the "Object is possibly null" error many times and usually I use a safety "if statement" in case it returns null. I've got the following function: const ModalOverlay = (props: any[]) => { const overlayEl = useRef(null); useEffect(() => { overlayEl.current.focus(); }); return <div {...props} ref={overlayEl} />; } But overlayEl.current gets the error "Object is not defined". So I've tried: