Skip to content

[useMediaQuery][utils] Remove usage of React 18 APIs#29870

Merged
eps1lon merged 4 commits intomui:masterfrom
eps1lon:fix/export-not-found
Nov 25, 2021
Merged

[useMediaQuery][utils] Remove usage of React 18 APIs#29870
eps1lon merged 4 commits intomui:masterfrom
eps1lon:fix/export-not-found

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Nov 24, 2021

Closes #29860

These new APIs aren't required for usage with React 18. The either fix some very rare bugs (tearing in useMediaQuery) or improve existing behavior (useId on the server).

However, in the meantime they disrupt usage with stable React releases which is not ok. Though until React 18 is stable, we need a workaround for webpack/webpack#14814.

A separate /compat entrypoint like react-redux will require a lot of work from our and consumer side so I don't think this'll be viable.

Ideally we'd just put this behind a feature flag instead of reverting but we don't have any infra for that.

@eps1lon eps1lon added type: bug It doesn't behave as expected. external dependency Blocked by external dependency, we can’t do anything about it. package: utils Specific to the utils package. hook: useMediaQuery labels Nov 24, 2021
@eps1lon eps1lon marked this pull request as ready for review November 24, 2021 13:23
@eps1lon eps1lon force-pushed the fix/export-not-found branch from 0f6dc58 to 82b49ec Compare November 24, 2021 20:53
@mui-pr-bot
Copy link

mui-pr-bot commented Nov 24, 2021

Details of bundle changes

@material-ui/core: parsed: -0.12% 😍, gzip: -0.14% 😍
@material-ui/lab: parsed: -0.15% 😍, gzip: -0.17% 😍

Generated by 🚫 dangerJS against 26025e3

@eps1lon eps1lon force-pushed the fix/export-not-found branch from 82b49ec to 26025e3 Compare November 25, 2021 01:04
@eps1lon eps1lon merged commit 1f3f078 into mui:master Nov 25, 2021
@eps1lon eps1lon deleted the fix/export-not-found branch November 25, 2021 10:57
@eps1lon eps1lon mentioned this pull request Nov 25, 2021
@oliviertassinari oliviertassinari added the scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI label Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external dependency Blocked by external dependency, we can’t do anything about it. hook: useMediaQuery package: utils Specific to the utils package. scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: "export 'useId' (imported as 'React') was not found in 'react'" after upgrading to v5.2.0

3 participants