Javascript 在jsx中传播儿童
jsx的等价物是什么Javascript 在jsx中传播儿童,javascript,reactjs,Javascript,Reactjs,jsx的等价物是什么 React.createElement('dl', {}, ...errorTermDescriptions(errors)) 我试过了 <dl> {errorTermDescriptions(errors)} </dl> (无差价)。这不是我想要的 <dl> {...errorTermDescriptions(errors)} </dl> 这在javascript中非常简单,jsx的等价物是什么 如果不可能,
React.createElement('dl', {}, ...errorTermDescriptions(errors))
我试过了
<dl>
{errorTermDescriptions(errors)}
</dl>
(无差价)。这不是我想要的
<dl>
{...errorTermDescriptions(errors)}
</dl>
这在javascript中非常简单,jsx的等价物是什么
如果不可能,我只想得到一个权威的答案。什么是
errorTermDescriptions(errors)
返回?@Ted是一个生成器函数。返回一个iterable。Iterables是唯一可以传播的东西。要明确的是,我现在的非jsx版本工作得非常好。我不是要讨论键,我要的是jsx等价的js版本,进一步研究,情节变厚,似乎这是巴贝尔的东西,它是{[…errorTermDescriptions(errors)]}
。由于某些原因,React JSX只接受数组和组件对象,因此不幸的是,您必须首先将其扩展到数组。
<dl>
{...errorTermDescriptions(errors)}
</dl>
Module parse failed: Unexpected token (377:7)
You may need an appropriate loader to handle this file type.
| __self: _this
| },
| {...errorTermDescriptions(errors)}
| )
| );