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
* fix: Table column updating
* fix tests
* add docs and examples
* cleanup
some of this will be added back in daniel's PR but was not important for this fix
* update docs
* Fix S2 example
made a separate story so it isn't included in the docs
---------
Co-authored-by: Devon Govett <[email protected]>
Copy file name to clipboardExpand all lines: packages/dev/docs/pages/react-aria/collections.mdx
+30-11
Original file line number
Diff line number
Diff line change
@@ -55,22 +55,22 @@ components like action menus where the items are built into the application rath
55
55
56
56
### Sections
57
57
58
-
Sections or groups of items can be constructed by wrapping the items in a `<Section>` element. A `<Header>` can also be
59
-
rendered within a `<Section>` to provide a section title.
58
+
Sections or groups of items can be constructed by wrapping the items in a section element. A `<Header>` can also be
59
+
rendered within a section to provide a section title.
60
60
61
61
```tsx
62
62
<Menu>
63
-
<Section>
63
+
<MenuSection>
64
64
<Header>Styles</Header>
65
65
<MenuItem>Bold</MenuItem>
66
66
<MenuItem>Underline</MenuItem>
67
-
</Section>
68
-
<Section>
67
+
</MenuSection>
68
+
<MenuSection>
69
69
<Header>Align</Header>
70
70
<MenuItem>Left</MenuItem>
71
71
<MenuItem>Middle</MenuItem>
72
72
<MenuItem>Right</MenuItem>
73
-
</Section>
73
+
</MenuSection>
74
74
</Menu>
75
75
```
76
76
@@ -179,9 +179,28 @@ function addAnimal(name) {
179
179
180
180
Note that `useListData` is a convenience hook, not a requirement. You can use any state management library to manage collection items.
181
181
182
+
### Dependencies
183
+
184
+
As described above, dynamic collections are automatically memoized to improve performance. Rendered item elements are cached based on the object identity
185
+
of the list item. If rendering an item depends on additional external state, the `dependencies` prop must be provided. This invalidates rendered elements
186
+
similar to dependencies in React's `useMemo` hook.
Note that adding dependencies will result in the _entire_ list being invalidated when a dependency changes. To avoid this and invalidate only an individual item,
199
+
update the item object itself to include the information rather than accessing it from external state.
200
+
182
201
### Sections
183
202
184
-
Sections can be built by returning a `<Section>` instead of an item from the top-level item renderer. Sections
203
+
Sections can be built by returning a section instead of an item from the top-level item renderer. Sections
185
204
also support an `items` prop and a render function for their children. If the section also has a header,
186
205
the <TypeLinklinks={docs.links}type={docs.exports.Collection} /> component can be used to render the child items.
187
206
@@ -207,12 +226,12 @@ let [sections, setSections] = useState([
0 commit comments