我收到一個錯誤,稱為Element type is invalid: expected a string (for built-in components) or a class/function (for Composite Components) but got: undefined in my new build react-app after register and login which I'我無法找到解決方案。
這是 =>
似乎錯誤是針對私人路線的
請在下面找到代碼片段:
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
export const PrivateRoute = ({ component: Component, ...rest }) => (
<Route {...rest} render={props => (
localStorage.getItem('user')
? <Component {...props} />
: <Redirect to={{ pathname: '/login', state: { from: props.location } }} />
)} />
)
需要解決方案。
uj5u.com熱心網友回復:
看起來像匯出問題 請像這樣匯出他的 QuizPage
const connectedQuizPage = connect(mapStateToProps, mapDispatchToProps)(App);
export { connectedQuizPage as QuizPage };
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/420412.html
標籤:
