Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined component issue

I’m getting an error called Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined in my newly built react-app after register and login which I’m unable to find the solution.

Here’s => the Working Demo

and the screen enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Seems like the error is for the private route

Please find the code piece below:

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 } }} />
    )} />
)

Need Solution.

>Solution :

Looks like export issue
Please export he QuizPage like this

const connectedQuizPage = connect(mapStateToProps, mapDispatchToProps)(App);
export { connectedQuizPage as QuizPage };
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading