1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

React – Uncaught Error: xxx is a void element tag

Posted at

エラー例

react-dom.development.js:2942 Uncaught Error: input is a void element tag and must neither have childrennor usedangerouslySetInnerHTML.

コード例


function App() {
  return (
    <>
      <input>AAA</input>
    </>
  )
}

export default App;

解決

他の要素を囲えないタグには他の要素を入れてはいけない
単一で利用しよう


function App() {
  return (
    <>
      <input value="AAA"/>
    </>
  )
}

export default App;


環境

next@13.1.1

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?