Skip to content

Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. #9249

Description

@shibli786

Do you want to request a feature or report a bug?
I think this is most probably is a Bug

index.js:946 Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.

How ever i have exported All component properly

// Forms.js

   import React from 'react'
   import ReactDOM from 'react-dom';
  export default class App extends React.Component{

      render(){
          return (
               <div>
             <ul>
	          <li>Home</li>
	     </ul>
                        {this.props.children}
              </div>
  	      );
      }
   }    


   export  class Home extends React.Component{

        render(){
         return (
               <div>
                     <h1>Home...</h1>
                 </div>
              )
       }
   }

//main.js

  import React from 'react';
  import ReactDOM from 'react-dom';
  import {App,Home} from './Forms.jsx';
  import {  Route, hashHistory } from 'react-router'
  import Router from 'react-router';

   ReactDOM.render((
       <Router history = {hashHistory}>
       <Route path = "/" component = {App}>
       <Route path = "/home" component = {Home} />
               </Route>
      </Router>
       ), document.getElementById('app'));




                "history": "^4.6.1",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-redux": "^5.0.3",
"react-router": "^4.0.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.2"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions