在jsx中传播孩子

时间:2018-06-15 15:48:22

标签: javascript reactjs

什么是

的jsx等价物
React.createElement('dl', {}, ...errorTermDescriptions(errors))

我已经尝试了

<dl>
  {errorTermDescriptions(errors)}
</dl>

这给了我一个关键错误(我知道,我知道,但在这种情况下,我真的不想使用密钥)。这是因为它相当于

React.createElement('dl', {}, errorTermDescriptions(errors))

(没有传播)。这不是我想要的

<dl>
  {...errorTermDescriptions(errors)}
</dl>

与此同时,webpack吓坏了

Module parse failed: Unexpected token (377:7)
You may need an appropriate loader to handle this file type.
|         __self: _this
|       },
|       {...errorTermDescriptions(errors)}
|     )
|   );

这在javascript中非常简单,jsx等价物是什么?

如果不可能,那就好了,我只想要一个权威的答案。

0 个答案:

没有答案