Skip to content

Instantly share code, notes, and snippets.

@velopert velopert/ERROR.md Secret
Last active Aug 31, 2016

Embed
What would you like to do?
React: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

Directory Structure

./src
├── containers
│    ├── App.js
│    ├── UserInfo.js
│    └── index.js
└── index.js

src/containers/App.js

import React, { Component } from 'react';
import { UserInfo } from 'containers'; // or import { UserInfo } from './index';

class App extends Component {
  render() {
    return (
        <UserInfo/>
    );
  }
}

export default App;

src/containers/UserInfo.js

import React, { Component } from 'react';

class UserInfo extends Component {
  render() {
    return (
        <div>UserInfo</div>
    );
  }
}

export default UserInfo;

src/containers/index.js

import UserInfo from './UserInfo';
import App from './App';

export { UserInfo, App }

src/index.js

import React from 'react';
import ReactDOM from 'react-dom';

import { App } from 'containers'

ReactDOM.render(
  <App />,
  document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.