[英]Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object in ReactJS
[英]NextJS: error - Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
我收到這個錯誤
錯誤 - 元素類型無效:應為字符串(對於內置組件)或類/函數(對於復合組件)但得到:object。
我的\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>
固定和工作
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.