TypeError: Cannot read property 'root' of undefined

后端 未结 2 1900
眼角桃花
眼角桃花 2021-01-22 04:54

I\'m trying to put a BasicTable function from Material-Ui to my React.js file.
Here is my code.

 import React, { Component } from \'react\';
 import { R         


        
2条回答
  •  太阳男子
    2021-01-22 05:25

    • You props does not contain classes
    • If you want to access classes that are in the styles constant, then you might want to do this styles(/*your theme name/*).root

    const { classes } = props; doing this is assigning classes=undefined then when you are trying to access classes.root it it throwing the error.

    Now, you can either change this

    
          

    TO

    // Because the theme argument is never used in the function
    
          

    OR change this line in Charity component

    {}

    TO

    {} given styles

    提交回复
    热议问题