LoginSignup
0
0

More than 1 year has passed since last update.

Error: Objects are not valid as a React child ... のエラーの対処法

Posted at

next.jsで開発をしていたら以下のエラーが発現した

Error: Objects are not valid as a React child (found: object with keys {boundaryYear, data}). If you meant to render a collection of children, use an array instead.

原因

JSONを表示させる際にそのまま表示させようとしていたのが原因だった

## 対処法

const hoge = () => {
   return (
      <>
         {obj}
      </>
   )
}

export default hoge

const hoge = () => {
   return (
      <>
         {JSON.stringify(obj)}
      </>
   )
}

export default hoge

に変更する

0
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
0
0