在我正在構建的 React Web 應用程序中,據說可能忘記導出一個組件。但是在檢查代碼時,導入和導出似乎很好由于我現在只使用轉儲組件,因此我嘗試將它們定義為不同的方式,例如使用粗箭頭函數,但沒有成功。以下是 Navbar 的片段 - SignIn 和 SignOut 組件也以與導航欄相同的方式聲明:import React from 'react';import { Link } from 'react-router-dom'import SignInLink from './SignInLink'import SignOutLink from './SignOutLink'const Navbar = () => { return ( <nav className="z-depth-10 black"> <div className="nav-wrapper container"> < Link to="/" className="brand-logo">Lelo's</Link> <SignInLink /> <SignOutLink /> </div> </nav> )}export default Navbar編譯后,我從瀏覽器得到這個:Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports
我的進口哪里出了問題?
Cats萌萌
2021-10-14 14:09:11