Always keep those 4 sections. If empty, write _Empty for now, to keep_
Empty for now, to keep
Empty for now, to keep
Empty for now, to keep
Empty for now, to keep
- Switch
useMediaQuerytouseSyncExternalStoreto fix crashes in React 19 caused by re-renders on mount when there are many components [customer-facing] (#171) AsuseSyncExternalStoreis only available in React 18+, this is a [BREAKING CHANGE] as thepeerDependencieshad to be bumped - Rename
useBreakpoint,BreakpointsProvider,BreakpointsContext->useMediaRange,MediaRangesProvider,MediaRangesContext(+ deprecate old exports) - Add
createMediaRanges& deprecateMediaRangesProviderandMediaRangesContext,
MediaRangesProviderandMediaRangesContext— usecreateMediaRangesinstead (#187)- The
asprop on the top-levelOnly(#187) — wrap children in the element you need, or usecreateMediaRanges'sOnly - The "breakpoint"-named aliases kept for backward compatibility after the rename (#181):
- exports:
useBreakpoint,BreakpointsProvider,BreakpointsContext - props on
BreakpointsProvider:breakpoints,additionalBreakpoints
- exports:
- Add
createMediaRanges+DEFAULT_MEDIA_RANGES, a strongly-typed alternative toMediaRangesProvider(#187)createMediaRanges(ranges)returns a{ useMediaRange, Only }pair bound to the ranges you pass in — no React context, noadditionalMediaRangesvsmediaRangessplit- The returned
useMediaRange/Onlyvalidate theonstring end-to-end: every space-separated token must match a declared range or its auto-generatedUp/Downalias. Invalid input surfaces a readable TypeScript error likeInvalid media ranges: foo barinstead ofnever - The returned
Onlyonly forwardschildren—asand arbitrary forwarded props are not supported; wrap your children in whatever element you need - Spread
DEFAULT_MEDIA_RANGESwhen you want to keep the defaults (xs,sm,md,lg,xl)
- Rename "breakpoint" to "media range" across the library, tests and documentation to better reflect that each name describes a range between two breakpoints rather than a single breakpoint (#181)
- New exports:
useMediaRange,MediaRangesProvider,MediaRangesContext - New props on
MediaRangesProvider:mediaRanges,additionalMediaRanges - Previous exports are kept but deprecated
- New exports:
- Migrate from yarn to pnpm (#200)
- Replace eslint & prettier by oxlint & oxfmt (#197)
- Replace jest & jest-dom & puppeteer & parcel with vite + vitest + playwright (#201 & #203)
- Update
README.md(#207)
See patches
MediaRangesProviderandMediaRangesContext— usecreateMediaRangesinstead (#187)- The
asprop on the top-levelOnly(#187) — wrap children in the element you need, or usecreateMediaRanges'sOnly - The "breakpoint"-named aliases kept for backward compatibility after the rename (#181):
- exports:
useBreakpoint,BreakpointsProvider,BreakpointsContext - props on
BreakpointsProvider:breakpoints,additionalBreakpoints
- exports:
- Add
createMediaRanges+DEFAULT_MEDIA_RANGES, a strongly-typed alternative toMediaRangesProvider(#187)createMediaRanges(ranges)returns a{ useMediaRange, Only }pair bound to the ranges you pass in — no React context, noadditionalMediaRangesvsmediaRangessplit- The returned
useMediaRange/Onlyvalidate theonstring end-to-end: every space-separated token must match a declared range or its auto-generatedUp/Downalias. Invalid input surfaces a readable TypeScript error likeInvalid media ranges: foo barinstead ofnever - The returned
Onlyonly forwardschildren—asand arbitrary forwarded props are not supported; wrap your children in whatever element you need - Spread
DEFAULT_MEDIA_RANGESwhen you want to keep the defaults (xs,sm,md,lg,xl)
- Rename "breakpoint" to "media range" across the library, tests and documentation to better reflect that each name describes a range between two breakpoints rather than a single breakpoint (#181)
- New exports:
useMediaRange,MediaRangesProvider,MediaRangesContext - New props on
MediaRangesProvider:mediaRanges,additionalMediaRanges - Previous exports are kept but deprecated
- New exports:
- Switch
useMediaQuerytouseSyncExternalStoreto fix crashes in React 19 caused by re-renders on mount when there are many components [customer-facing] (#171) AsuseSyncExternalStoreis only available in React 18+, this is a [BREAKING CHANGE] as thepeerDependencieshad to be bumped
See patches
- Switch
useMediaQuerytouseSyncExternalStoreto fix crashes in React 19 caused by re-renders on mount when there are many components [customer-facing] (#171, tests in #172) If you are on React 16.8+ / React 17, you'll need to use use-sync-external-store to polyfilluseSyncExternalStoreadded in React 18.- Add
getServerSnapshotto fix crashes on Node (#174)
- Add
- Migrate build system from
microbundletotsdown[internal, may impact devs] (#144) - Update TypeScript config [internal]
- Other internal dev / tests changes [internal]
- Update
mock-match-mediato v1 (#95) - Bump
typescriptfrom 5.7.2 to 5.9.3 (#120) - Bump
eslintfrom 10.2.1 to 10.4.0 (#145, #167) - Bump
@eslint-react/eslint-pluginfrom 1.18.0 to 5.7.10 (#119, #146, #154, #170) - Bump
@typescript-eslint/parserfrom 8.18.0 to 8.58.0 and typescript-eslint group bumps (#117, #131, #150, #153, #166, #149) - Bump
jest-environment-jsdomfrom 29.7.0 to 30.4.1 + manual Jest update (#125, #156, #164) - Bump
ts-jestfrom 29.2.5 to 29.4.6 (#116) - Bump
jest-puppeteerfrom 10.1.4 to 11.0.0 (#118) - Bump
puppeteerfrom 24.42.0 to 25.0.2 (#160, #169) - Bump
@testing-library/domfrom 10.4.0 to 10.4.1 (#128) - Bump
parcelfrom 2.13.2 to 2.16.4 (#130) - Bump
tsdownfrom 0.21.10 to 0.22.0 (#161) - Bump
@types/nodefrom 25.6.0 to 25.8.0 (#157, #168) - Bump
wsfrom 8.20.0 to 8.20.1 (#173) - Bump
actions/setup-nodefrom 3 to 6,actions/checkoutfrom 3 to 6 (#114, #115) - Add Node.js 24.x and 25.x and 26.x to the CI matrix (#113, #163, (#165))
- Add Dependabot configuration (npm, GitHub Actions, React and typescript-eslint groups) (#112, #149, #158)
- Update
- Drop support for
Matchas this is an anti pattern (crawling children + leaking into the web TS globals) [BREAKING CHANGE] - Drop support for
toJSON&toCSS[BREAKING CHANGE] - Drop support for node 16 & 18, and add for 20 & 22
- Update support TS version to 5.7.2 (shouldn’t impact people depending on
@blocz/react-responsive) - Mark React 19 as available
See patches
- Add
getServerSnapshotto fix crashes on Node (#174) - Internal library updates
- Bump
wsfrom 8.20.0 to 8.20.1 (#173)
- Bump
- Other internal changes
- Add Node.js 26.x in (#165)
- Switch
useMediaQuerytouseSyncExternalStoreto fix crashes in React 19 caused by re-renders on mount when there are many components [customer-facing] (#171, tests in #172) If you are on React 16.8+ / React 17, you'll need to use use-sync-external-store to polyfilluseSyncExternalStoreadded in React 18. - Migrate build system from
microbundletotsdown[internal, may impact devs] (#144) - Update TypeScript config [internal]
- Other internal dev / tests changes [internal]
- Update
mock-match-mediato v1 (#95) - Bump
typescriptfrom 5.7.2 to 5.9.3 (#120) - Bump
eslintfrom 10.2.1 to 10.4.0 (#145, #167) - Bump
@eslint-react/eslint-pluginfrom 1.18.0 to 5.7.10 (#119, #146, #154, #170) - Bump
@typescript-eslint/parserfrom 8.18.0 to 8.58.0 and typescript-eslint group bumps (#117, #131, #150, #153, #166, #149) - Bump
jest-environment-jsdomfrom 29.7.0 to 30.4.1 + manual Jest update (#125, #156, #164) - Bump
ts-jestfrom 29.2.5 to 29.4.6 (#116) - Bump
jest-puppeteerfrom 10.1.4 to 11.0.0 (#118) - Bump
puppeteerfrom 24.42.0 to 25.0.2 (#160, #169) - Bump
@testing-library/domfrom 10.4.0 to 10.4.1 (#128) - Bump
parcelfrom 2.13.2 to 2.16.4 (#130) - Bump
tsdownfrom 0.21.10 to 0.22.0 (#161) - Bump
@types/nodefrom 25.6.0 to 25.8.0 (#157, #168) - Bump
actions/setup-nodefrom 3 to 6,actions/checkoutfrom 3 to 6 (#114, #115) - Add Node.js 24.x and 25.x to the CI matrix (#113, #163)
- Add Dependabot configuration (npm, GitHub Actions, React and typescript-eslint groups) (#112, #149, #158)
- Update
- Drop support for
Matchas this is an anti pattern (crawling children + leaking into the web TS globals) [BREAKING CHANGE] - Drop support for
toJSON&toCSS[BREAKING CHANGE] - Drop support for node 16 & 18, and add for 20 & 22
- Update support TS version to 5.7.2 (shouldn’t impact people depending on
@blocz/react-responsive) - Mark React 19 as available
Pre-releases
- Drop support for
toJSON&toCSS[BREAKING CHANGE]
- Drop support for
Matchas this is an anti pattern (leaking into the web TS globals) [BREAKING CHANGE] - Drop support for node 16 & 18, and add for 20 & 22
- Update support TS version to 5.7.2 (shouldn’t impact people depending on
@blocz/react-responsive) - Mark React 19 as available
- The package was renamed
@blocz/react-responsiveinstead ofreact-only - rename
useOnlytouseBreakpointanduseQuerytouseMediaQuery[BREAKING CHANGE] useBreakpointanduseMediaQuerystop returningundefinedduring the initialization and if the media query is invalid [BREAKING CHANGE]- Avoid sending a warning on react 17
- Fix
onlyandmatchMediaprops on DOM elements for theMatchcomponent - Remove prop
strict[BREAKING CHANGE] - Fix
exportsfield in package.json - Drop support for node 13 and add support for node 15 and 16
- Mark React 18 as available + fix types for React 18.
See patches
- Add
typesfield inexportsin package.json - Mark React 18 as available + fix types for React 18.
- Better fix
onlyandmatchMediaprops on DOM elements for theMatchcomponent- with the implementation of the v3.0.0, we were polluting the global scope, injecting the variable
Reacteverywhere. This version ships a better fix for both of them.
- with the implementation of the v3.0.0, we were polluting the global scope, injecting the variable
- Add support for node 15 and 16
- Fix
exportsfield in package.json- use correct
lib/folder instead ofdist/ - Use proper
.mjsfor node
- use correct
- Drop support for node 13
- The package was renamed
@blocz/react-responsiveinstead ofreact-only - rename
useOnlytouseBreakpointanduseQuerytouseMediaQuery[BREAKING CHANGE]- Those were renamed for 2 reasons:
useOnlyisn’t really explicituseQuerycan be confused with react-query’s or apollo’s useQuery hooks
- Those were renamed for 2 reasons:
useBreakpointanduseMediaQuerystop returningundefinedduring the initialization and if the media query is invalid. Instead it will directly use the correct value, and if the media query is invalid, it’ll returnfalse. [BREAKING CHANGE]- Bump peerDependencies to allow for react 17
- Drop support for node 10
- Remove prop
strict: [BREAKING CHANGE]- This feature was initially introduced to avoid collision between
mdUpandsmDownfor instance. But since we avoid the overlapping of breakpoints in the v1.0.1 and as this is customizable, this prop doesn't make sense anymore. - This prop relied on
calc(% + 1px)andcalc(% - 1px)which has 2 issues:- difficult to be compatible with SSR as for instance css-mediaquery crashes when we use
calc()(see issue), 1pxis really arbitrary and not customizable so anyway if someone wanted to change that, they had to use custom breakpoints.
- difficult to be compatible with SSR as for instance css-mediaquery crashes when we use
- This feature was initially introduced to avoid collision between
- Fix
onlyandmatchMediaprops on DOM elements for theMatchcomponent- Inject
MatchChildPropsinHTMLAttributesfrom the global namespaceReact
- Inject
- The package was renamed
@blocz/react-responsiveinstead ofreact-only - Fix
onlyandmatchMediaprops on DOM elements for theMatchcomponent
- Remove prop
strict
- rename
useOnlytouseBreakpointanduseQuerytouseMediaQuery[BREAKING CHANGE]- Those were renamed for 2 reasons:
useOnlyisn’t really explicituseQuerycan be confused with react-query’s or apollo’s useQuery hooks
- Those were renamed for 2 reasons:
useBreakpointanduseMediaQuerystop returningundefinedduring the initialization and if the media query is invalid. Instead it will directly use the correct value, and if the media query is invalid, it’ll returnfalse. [BREAKING CHANGE]- Bump peerDependencies to allow for react 17
- Drop support for node 10
- remove polyfill for matchMedia minor breaking change
- add
useQuery - drop
mediainuseOnly[BREAKING CHANGE] - use Node 13
exportsfield - add
toJSONandtoCSSfor CSS-in-JS support
See patches
- remove wrong dependency on
emotion
- add
toJSONandtoCSSfor CSS-in-JS support
- Use Node 13 conditional exports: https://nodejs.org/api/esm.html#esm_conditional_exports
- remove polyfill for matchMedia (it should be define by the users) minor breaking change
- add new hook
useQueryand use it internally inOnlyfor the propmatchMedia - drop
queryinuseOnly[BREAKING CHANGE]- as there is a new hook
useQuerythat deals with media queries, the 2nd argument ofuseOnlywas redundant - new signature:
- before:
useOnly = (on?: string, media?: string, strict?: boolean) => boolean | undefined - after:
useOnly = (on?: string, strict?: boolean) => boolean | undefined
- before:
- as
onandmediawere join with aor, you can still mimic the previous behavior by doing:- before:
const isVisible = useOnly(on, media, strict);
- after:
const a = useOnly(on, strict); const b = useQuery(media); const isVisible = a || b;
- before:
- as there is a new hook
- change 3rd option in breakpoint to be an
optioninstead of just the unit
See patches
- the 3rd option of every breakpoint is instead of a unit string, a string representing the unit or an object with two keys:
unitas before ("px", "em", ...)direction"width"or"height"
useOnlyreturnsundefinedbefore being initialized- fix bugs
- expose
MatchChildProps
See patches
- expose
MatchChildProps
- re-use
useLayoutEffectto reduce delay between initialization and true values
- fix non-valid breakpoints
- avoid crashing when
windowis not defined
useOnlyreturnsundefinedbefore being initialized (no changes inOnlyandMatch) minor breaking change
- Use React's context
- Drop Preact support [BREAKING CHANGE]
- Remove
toCSS,toJSONandtoMediaQuery[BREAKING CHANGE]
See patches
- revert back to
addListenerinstead ofaddEventListeneronmatchMediafor better browser supports
- Remove Preact support (won't be an issue with Preact 10) [BREAKING CHANGE]
- Use and expose
BreakpointsContextinstead of a class to store breakpoints - Remove
toCSS,toJSONandtoMediaQuery[BREAKING CHANGE] - Stop debouncing
isShownbecause as it's a boolean, React isn't re-rendering if the same value is re-set Onlyaccepts other props when the propasis used type fix
Pre-releases
- Use
useEffectinuseOnly - Stop debouncing
isShownbecause as it's a boolean, React isn't re-rendering if the same value is re-set
- Use
useLayoutEffectinuseOnlyto reduce the delay before changing the DOM - Remove
toCSS,toJSONandtoMediaQuery[BREAKING CHANGE]
- Remove Preact support (won't be an issue with Preact X) [BREAKING CHANGE]
- Use and expose
BreakpointsContextinstead of a class to store breakpoints - Change API of
toCSS,toJSONandtoMediaQuery(need to provide the breakpoints) [BREAKING CHANGE]
- Upgrade to TypeScript
- Add
useOnlyhook
See patches
- Create and expose a union type
Unitsinstead of an enum for the available css units
- Change npmignore and change README
- Avoid overlapping breakpoints in defaults [BREAKING CHANGE]
- Add
useOnlyhook - Change internals to use
useOnly - Upgrade to TypeScript
- Add strict mode
- Add support for Parcel
See patches
- Add prop
asin<Match>
- Add support for Fragments (when the prop
asisn't set on<Only>) for Preact
- Change build system
- Add support for
<Match>for Parcel
- Add support for Parcel
- Add
<Match>component
See patches
- Fix bug when
nullwas a child of<Match>
- Fix in README
toCSS,toJSON - Add badges in README
- Add
<Match>component
- Add
<Only>component - Add
<BreakpointsProvider>component - Add
toCSS - Add
toJSON - Add
toMediaQuery