mbrn / material-table

Datatable for React based on material-ui's table with additional features
https://material-table.com
MIT License
3.5k stars 1.02k forks source link

Error: Element type is invalid #46

Closed ModPhoenix closed 6 years ago

ModPhoenix commented 6 years ago

Hi guys,

What am I doing wrong? I just add code like in the example, but I get an error.

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
  render() {
    return (
      <ClientModuleLayout
        title="Lots"
        footerLink={this.footerLink}
        menuList={this.menuList}
      >
        <MaterialTable
          columns={[
            {title: 'Adı', field: 'name'},
            {title: 'Soyadı', field: 'surname'},
            {title: 'Doğum Yılı', field: 'birthYear', type: 'numeric'},
            {title: 'Doğum Yeri', field: 'birthCity', lookup: {34: 'İstanbul', 63: 'Şanlıurfa'}}
          ]}
          data={[{name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63}]}
          title="Demo Title"
        />
      </ClientModuleLayout>
    );
  }
mbrn commented 6 years ago

Hi @ModPhoenix ,

I will check it and return. It seems that something related with dependencies.

mbrn commented 6 years ago

@ModPhoenix , Problem resolved. you can take latest version(0.6.5).

Code is too fresh:). If you find any other bugs please submit a issue.

wangxpert commented 5 years ago

Is this bug fixed? I am still getting the same error even though i am using 1.50.0.

I am using exactly the same code just for testing but it's showing me the same error.

Here is package.json on my side. { "name": "dispensary-client-web", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^4.4.0", "@material-ui/icons": "^4.2.1", "aws-amplify": "^1.1.36", "aws-amplify-react": "^2.3.12", "material-table": "^1.50.0", "node-sass": "^4.12.0", "notistack": "^0.8.9", "prop-types": "^15.7.2", "react": "^16.9.0", "react-dom": "^16.9.0", "react-redux": "^7.1.1", "react-router-dom": "^5.0.1", "react-scripts": "3.1.1", "redux": "^4.0.4", "redux-saga": "^1.0.5", "reduxsauce": "^1.1.0" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "precommit": "lint-staged", "prepush": "lint-staged" }, "lint-staged": { "*.{js,jsx}": [ "pretty-quick --staged", "eslint src/ --fix", "git add" ] }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "babel-core": "^6.26.3", "babel-eslint": "10.0.2", "eslint": "^6.2.2", "eslint-config-airbnb": "^18.0.1", "eslint-config-prettier": "^6.1.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react": "^7.14.3", "husky": "^3.0.4", "lint-staged": "^9.2.5", "prettier": "^1.18.2", "pretty-quick": "^1.11.1" } }