Render Object properties in React(在 React 中渲染对象属性)
问题描述
我有一个这样的对象
我的代码
我在循环对象时遇到问题.
得到的错误是这样的
Information.render():必须返回一个有效的 React 元素(或 null).您可能返回了未定义、数组或其他一些无效对象
如何循环遍历对象,从而得到得到的结果
提前致谢.任何帮助表示赞赏
你正在渲染一个数组,但是你只能从你的 react 组件返回一个块,将你的 map 函数包装在一个 div 中
I have a object like this
My code
Im having trouble looping through the object.
Error obtained is like this
Information.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object
How can I loop thorugh the object so that the obtained result is obtained
Thanks in advance. Any help is appreciated
You are rendering an array but you can only return a single block from your react component, wrap your map function within a div
这篇关于在 React 中渲染对象属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!