[all components] Avoid using DOM to derive state
- Dominant language
- TypeScript
- Stars
- 10.9k
- Forks
- 543
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 101
Description
# Bug report
## Current behavior
In some components we depend on the DOM in order to derive some state, which causes the components to need to be rendered multiple times to get to the final state. Some example sinclude:
- https://github.com/mui/base-ui/blob/a4017b603c1709f4593502bc02b06130647f664b/packages/react/src/field/label/FieldLabel.tsx#L29-L36
- https://github.com/mui/base-ui/blob/a4017b603c1709f4593502bc02b06130647f664b/packages/react/src/radio/root/RadioRoot.tsx#L68-L72
- https://github.com/mui/base-ui/blob/a4017b603c1709f4593502bc02b06130647f664b/packages/react/src/tabs/tab/TabsTab.tsx#L101
In general we can search for `useIsoLayoutEffect` calls that update some state inside.
## Expected behavior
It would be great if we can have an alternative API to avoid this.
Contributor guide
Assessment
This issue has not been assessed yet.