Skip to content Skip to sidebar Skip to footer

Cannot Read 'component' Of Undefined: Using Material-ui With Browserify

I'm using browserify to manage my dependencies, as suggested on the material-ui setup doc. When I try to run my code, the console gives me this message: Uncaught TypeError: Cannot

Solution 1:

Found the answer hidden in the docs!

Apparently this is a required part of material-ui (I don't know why they didn't include it as part of the set-up), but I needed to include this snippet in my rendered classes:

childContextTypes: {
    muiTheme: React.PropTypes.object
},

getChildContext: function() {
    return {
      muiTheme: ThemeManager.getCurrentTheme()
    };
},

Post a Comment for "Cannot Read 'component' Of Undefined: Using Material-ui With Browserify"