Shopify / quilt

[⚠️ Deprecated] A loosely related set of packages for JavaScript/TypeScript projects at Shopify
MIT License
1.7k stars 222 forks source link

[react-hooks] Do not throw when using useMedia in SSR without providing an initialValue #2813

Closed melnikov-s closed 4 months ago

melnikov-s commented 4 months ago

Description

Fixes (issue #)

We'll no longer throw if initialValue is not provided in SSR, though this will result in hydration mismatch and providing an initialValue should be considered required for SSR, but since there's no way to enforce this at type/build time we've opted to go with this approach instead.

Related discussion can be found here