0
我正在嘗試使用JSPM和ES6通過Babel爲React設置Material UI。React,Material UI,JSPM和Babel:錯誤:無法添加屬性上下文,對象不可擴展
1)安裝材料的UI與jspm install material-ui=npm:material-ui
2)這給了我進口材料UI到我的陣營組件文件這樣的能力:import {TextField, LeftNav} from 'material-ui'
在這一點上我得到正確的引用到我ES6文件,所以如果我做了 console.log(TextField); 我得到了打印的反應組分。
可悲的是我現在的問題是試圖JSX
return (
<div>
<TextField />
</div>
)
使用該組件時遇到錯誤拋出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
基礎上的警告,我想該錯誤可能是由工具Babel + JSPM + Material-UI組合創建的特定情況造成的。