[英]NextJS: error - Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
I am getting this error我收到这个错误
error - Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.错误 - 元素类型无效:应为字符串(对于内置组件)或类/函数(对于复合组件)但得到:object。
My \components\LayoutWrapper.js我的\components\LayoutWrapper.js
import Logo from "@next/svg"
<div className="mr-3 pt-2">
<Logo src={icon} width="25px" height="25px" />
{typeof siteMetadata.headerTitle === 'string' ? (
<div className=""></div>
) : (
siteMetadata.headerTitle
)}
</div>
Fixed and working固定和工作
import Image from 'next/image'
import logo from '../assets/images/logo.svg'
<div className="mr-3 pt-2">
<Image src={logo} width="25px" height="25px" />
{typeof siteMetadata.headerTitle === 'string' ? (
<div className=""></div>
) : (
siteMetadata.headerTitle
)}
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.