React.createElement: type invalid - expected string (for inline components) or class / function (for composite components) but returned: undefined

Im using call-router-dom V 4.0 .; react-router v 4.0.0 along with webpack

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import Nav from './component/nav';

ReactDOM.render(
  <Nav />,
  document.getElementById('container')
);
      

Run codeHide result


nav.js

import React, {Component} from 'react';
import { BrowserRouter as Router, Link, Match, Miss } from 'react-router-dom';
import Home from "./home"


const Nav = () => {
  return (
      <div>
      	<Router>
	        <Link to='/home'>Home</Link>
	        <Match pattern='/home' component={Home}> </Match>
        </Router>
      </div>
    );
  };
export default Nav;
      

Run codeHide result


home.js

import React from 'react';

const Home = () => {
    return (
        <div>
            <h2>Home</h2>
        </div>
    );
};

export default Home;
      

Run codeHide result


I've tried using both react-router and react-router-dom, but I get the same error. Already tried the solution I found on the internet but the same error. I really don't understand what is causing the error.

Edit: The error shows up in the browser: vendors.js% 20line% 20203% 20% 3E% 20eval: 36: 9

+3


source to share





All Articles