Cosmin
Cosmin

Reputation: 2082

React, Material UI, JSPM and Babel : Error: Can't add property context, object is not extensible

I am trying to setup Material UI for React, using JSPM and ES6 through Babel.

1) installed material-ui with jspm install material-ui=npm:material-ui

2) this gave me the ability to import material ui into my React Component files like this : import {TextField, LeftNav} from 'material-ui'

At this point I get the right references into my ES6 file, so if I do a console.log(TextField); I get the react component printed.

Sadly my current issue is that I'm getting errors when trying to use the component in jsx

   return (
     <div>
       <TextField />
     </div>
   ) 

throws an error :

Warning: getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.
warning.js:17 Warning: Something is calling a React component directly. Use a factory or JSX instead. See: http://fb.me/react-legacyfactory
warning.js:26 Warning: TextField(...): No `render` method found on the returned component instance: you may have forgotten to define `render` in your component or you may have accidentally tried to render an element whose type is a function that isn't a React component.
warning.js:17 Warning: Don't set the props property of the component. Mutate the existing props object instead.
dashboard:1 Uncaught (in promise) Error: Can't add property context, object is not extensible
    Error loading http://localhost:3000/app.js
    at ReactCompositeComponentMixin.mountComponent 

Based on the warnings, I'm thinking that the error may be caused by a specific situation created by the combination of tools, Babel+JSPM+Material-UI.

Upvotes: 0

Views: 1035

Answers (1)

Hai Nguyen
Hai Nguyen

Reputation: 4059

Check the version of react you're running. It should be v0.13.3. More info can be found here: https://github.com/callemall/material-ui/issues/1303

Upvotes: 1

Related Questions