Multiple children supported
texttechne opened this issue · 4 comments
With the next release we will probably support multiple children.
This affects these rules, which are not needed any more:
- jsx-for-single-child
- jsx-if-single-child
I'm not clear with the multiple children solution. Can you update the documentation and add some examples, before I can decide?
Doc update is coming, but to give you an example:
<If condition={true}>
<span />
<span />
</If>
This is now valid and doesn't throw any error anymore.
The same goes for <Else> | <For> | <When> | <Otherwise>
.
@vkbansal The mentioned feature is live and docs are updated.
While I cannot think of an use case for the <For>
loop, the <If>
rule could make sense, if I want to ensure, that multiple children never get returned from a render call. So the following error would be prevented:
render() {
return (
<If>
<span />
<span />
</If>
)
}
However, then this rule should also apply for <Else> | <When> | Otherwise
.
removed!