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
に変更する