Update (March 17th, 2019)
As described in detail in #123, I'm seriously considering publishing the current changes under a minor version bump: 1.10. The bulk of the preparations for this have already been done in #123.
The next step would be to implement a v2 which uses hooks for the core functionality. I expect a hooks implementation could simplify some of the internals, and would simultaneously allow us to ship a hook as part of the API.
2.0 1.10
2.1 2.0 (now available as react-media@next)
I propose exposing Media as the default export and exporting the hook as a named export:
import Media, { useMedia } from 'react-media';
This would allow people to seamlessly upgrade to v2, without having to change existing code. There's also not really any use in splitting things up, since the Media component will be very small (just a wrapper around the hook), and it will use the hook under the hood. So I don't expect us splitting up the files will result in significant bundle size savings.
Update (March 17th, 2019)
As described in detail in #123, I'm seriously considering publishing the current changes under a minor version bump:
1.10. The bulk of the preparations for this have already been done in #123.The next step would be to implement a v2 which uses hooks for the core functionality. I expect a hooks implementation could simplify some of the internals, and would simultaneously allow us to ship a hook as part of the API.
2.01.10queryprop toqueries(Change query to queries #72)componentDidMount(solves Two-pass render on the client #81, Is this SSR ready out of the box? #91, React strict mode #109, PR: Implement two-pass render (closes #81) #96)<Strict>mode (Wrap all tests in <Strictmode> #115)queries#119)2.12.0 (now available asreact-media@next)implement a hooks API, exposed asreact-media/hooksuseMediahook<Media>component, which is compatible with v1.10, but uses said hook internallyI propose exposing
Mediaas the default export and exporting the hook as a named export:This would allow people to seamlessly upgrade to v2, without having to change existing code. There's also not really any use in splitting things up, since the Media component will be very small (just a wrapper around the hook), and it will use the hook under the hood. So I don't expect us splitting up the files will result in significant bundle size savings.