You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/jsx-in-depth.md
+24-1Lines changed: 24 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,30 @@ function App2() {
245
245
}
246
246
```
247
247
248
-
Spread attributes can be useful when you are building generic containers. However, they can also make your code messy by making it easy to pass a lot of irrelevant props to components that don't care about them. We recommend that you use this syntax sparingly.
248
+
You can also pick specific props that your component will consume while passing all other props using the spread operator.
In the example above, the `kind` prop is safely consumed and *is not* passed on to the `<button>` element in the DOM.
269
+
All other props are passed via the `...other` object making this component really flexible. You can see that it passes an `onClick` and `children` props.
270
+
271
+
Spread attributes can be useful but they also make it easy to pass unnecessary props to components that don't care about them or to pass invalid HTML attributes to the DOM. We recommend using this syntax sparingly.
0 commit comments