0

I am trying to test Material-UI components on CodeSandbox. And keep getting the error:

TypeError undefined is not an object (evaluating '_context$muiTheme.borderRadius')

enter image description here

What am I doing wrong?

Eduard
  • 8,437
  • 10
  • 42
  • 64

1 Answers1

1

The solution was to import this elements from Material UI:

import getMuiTheme from 'material-ui/styles/getMuiTheme'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'

And wrap the app with them:

render(<MuiThemeProvider muiTheme={getMuiTheme()}><App /></MuiThemeProvider>, document.getElementById('root'));

Without them we are not getting any styles from Material UI and without them Material UI cannot work.

This is the correct implementation: https://codesandbox.io/s/l9v5q2548z

Eduard
  • 8,437
  • 10
  • 42
  • 64