react
椰子牛
这个作者很懒,什么都没留下…
展开
-
ES6语法报错
报错如下:compiler.hooks.done.tap('done', async stats => { ^^^^^SyntaxError: missing ) after argument list at Object.exports.runInThisContext (vm.js:76:16) ...原创 2019-08-14 10:39:48 · 1328 阅读 · 0 评论 -
Object are not valid as a React child(found: object with keys{userId, sex, city}).
使用mock模拟接口时react报错⬇️原因是传过来的数据是一个json对象,不能直接输出,要指出具体的key名,如:this.state.news.userId;原创 2019-08-12 19:05:37 · 276 阅读 · 0 评论 -
TypeError: Cannot read property 'map' of null
这是因为news在this.state = { //...}中初始化时设置为空,后续通过axios获得数据,在遍历数组时要加一个空值判断;render() { const newsList = (this.state.news || []).map((item, index) => <p>{item}</p> ); re...原创 2019-08-12 19:08:29 · 4221 阅读 · 0 评论