React浏览器运行报错收集

问题1:
Uncaught Error: Objects are not valid as a React child

结论:渲染问题,一般是渲染时组件名写错或者格式错误。另外就是JSX中的数组对象必须要在外围有类似<div>之类的html标签包围,否则也会出现此类错误



问题2:
Adjacent JSX elements must be wrapped in an enclosing tag

结论:JSX语法问题,需要用一个tag将整个JSX包围,可以使用<Fragment>,这样不会影响标签结构

问题3:
Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state.

结论:出现在组件事件中,组件事件必须写成一个函数

评论

暂无评论