Import Issue for React-Table

后端 未结 4 1519
我在风中等你
我在风中等你 2021-01-21 23:51

I am creating a table in react using react-table library. Few days back, I had created a table using the same library and faced no issues. But today I am getting the following e

相关标签:
4条回答
  • 2021-01-22 00:32

    You're doing it in the version 6 way, and installing a later version of react-table. Based on comment found here: React table does not contain a default export, you need to install react-table-6 instead of react-table and replace it as well on your imports.

    0 讨论(0)
  • 2021-01-22 00:37

    You need to use the react-table-6

    Use this command using Terminal or Command Prompt

    > npm i react-table-6 --save
    
    import ReactTable from 'react-table-6';
    
    import 'react-table-6/react-table.css';
    

    Now it will work

    0 讨论(0)
  • 2021-01-22 00:43

    Solved the problem!!!

    You have to install

    npm install react-table-6

    and then import

    import React, {Component} from 'react';
    
    import ReactTable from 'react-table-6';
    
    import 'react-table-6/react-table.css';
    
    

    its solved:) Reference https://www.npmjs.com/package/react-table-6

    0 讨论(0)
  • 2021-01-22 00:47

    I don't know which version of React Table you're using, but looking at the code of the latest version (here), there is no default export, neither a ReactTable export.

    It seems that it is now using hooks, so you should use the useTable hook to create a table with the latest version (doc here).

    0 讨论(0)
提交回复
热议问题