[tree view] Allow callback form of useRef
#14267
Labels
component: tree view
TreeView, TreeItem. This is the name of the generic UI component, not the React module!
new feature
New feature or request
typescript
Summary
The
apiRef
forSimpleTreeView
currently must be a MutableRefObject. If it supported any React ref - a callback instead of a mutable object - it would be more consistent with React and more flexible for developers.Examples
Motivation
Our component renders several smaller tree views, separated by subheaders. It would be helpful to have access to all of the tree views' APIs from the rendering component. A callback ref can be used to maintain a list, but there's no obvious way to make this work with a MutableRefObject.
See also #6234, which requests the same functionality for the data grid.
Search keywords: useRef
The text was updated successfully, but these errors were encountered: