-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react之Fragments使用方法及使用场景 #45
Comments
React 中的一个常见模式是一个组件返回多个元素。Fragments 允许你将子列表分组,而无需向 DOM 添加额外节点。
还有一种新的短语法可用于声明它们。 动机一种常见模式是组件返回一个子元素列表。以此 React 代码片段为例:
得到一个
Fragments 解决了这个问题。 用法
这样可以正确的输出
短语法你可以使用一种新的,且更简短的语法来声明 Fragments。它看起来像空标签:
你可以像使用任何其他元素一样使用 带 key 的 Fragments使用显式
|
react之Fragments使用方法及使用场景
The text was updated successfully, but these errors were encountered: