Reputation: 3
I'm using MUI DataTable and I'm trying to add "Add Icon" to the toolbar. I've tried this: https://github.com/gregnb/mui-datatables/blob/master/examples/customize-toolbar/CustomToolbar.js but it didnt work. Error: 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, or you might have mixed up default and named imports. What's the proper and simplest way to add this icon? I have no idea how to do this.
Upvotes: 0
Views: 2977
Reputation: 1
As I see in the provided link your class component is exported as default. Thus, please make sure that, in the component that the MUI Datatable is located, you are importing the custom toolbar component like this:
import CustomToolbar from '...path/to/CustomToolbar';
and not like this:
import {CustomToolbar} from '...path/to/CustomToolbar';
Upvotes: -1