React.createElement:type无效 - 期望一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:undefined

时间:2017-03-24 03:56:07

标签: reactjs webpack

我正在使用react-router-dom V 4.0。 react-router v 4.0.0以及webpack

Index.js

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

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

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;

home.js

import React from 'react';

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

export default Home;

我尝试使用react-router和react-router-dom,但我确实得到了同样的错误。我已经尝试过在互联网上找到的解决方案但是会出现同样的错误。我真的不明白导致错误的原因。

编辑:浏览器中显示错误:vendors.js%20line%20203%20%3E%20eval:36:9

0 个答案:

没有答案