Description
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
- change
query
prop toqueries
(Change query to queries #72) - two-pass render + migrate to
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) - run tests in
<Strict>
mode (Wrap all tests in <Strictmode> #115) - merge [WIP] Backward compatibility for the query prop #123
- polish the docs (Start rewriting docs towards
queries
#119) - publish a prerelease, and have some people test it out in their production apps
2.1 2.0 (now available as react-media@next
)
implement a hooks API, exposed asreact-media/hooks
- reimplement the core functionality using hooks, expose a
useMedia
hook - implement a
<Media>
component, which is compatible with v1.10, but uses said hook internally
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.