'React table does not contain a default export
I want to create a table in react using react-table library
version: "react-table": "^7.0.0-rc.15"
When I try this:
import ReactTable from 'react-table'
import 'react-table/react-table.css'
I get the following error:
Attempted import error: 'react-table' does not contain a default export (imported as 'ReactTable').
Solution 1:[1]
Try to install react-table-6 [https://www.npmjs.com/package/react-table-6][1] and use instead react-table. Its work for me.
Solution 2:[2]
Make sure the correct react-table version installed; This one works for me.
"react-table": "^6.10.3"
Solution 3:[3]
According to the docs that's not how you use that library.
You want to import the hooks instead:
import {
useTable,
useGroupBy,
useFilters,
useSortBy,
useExpanded,
usePagination,
} from 'react-table'
Solution 4:[4]
0
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';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Maroon4 |
Solution 2 | |
Solution 3 | Alex Wayne |
Solution 4 | Kumar_Saurabh |