0.0.82 • Published 6 years ago

react-mql-manager v0.0.82

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

React-MQL-Manager

npm version

React-MQL-Manager is an unopinionated, flexible set of modules allowing you to handle media queries in React (or JS generally) regardless of your approach to state management. It internally constructs Media Query Lists and provides an API allowing you to react to changes.

Not Using a State Management Library

If you are not using a state-management library, React-MQL-Manager exports a <Provider> component to pass your queries down your component tree, as well as a higher-order component: withMediaQueries, or alternatively, a <MediaQueriesRenderProps> component to wrap any child component that needs to access the queries match state.

Using a State Management Library

If you are using a state-management library, you will interact with the core class of the library, the MQL-Manager class. This class (not a React component) internally constructs your Media Query Lists based on a simple queries argument you provide.

The onChange argument you provide fires every time one of your queries' match state changes, but can be debounced using the optional debounce argument (type: Num of milliseconds).

Install

React-MQL-Manager can be consumed as CommonJS modules, ES modules or UMD.

yarn add react-mql-manager

or

npm i react-mql-manager

Demo

See a codesandbox.io demo of React-MQL-Manager with no state management lib, Redux, and Mobx, and React-Broadcast here

Troubleshooting

See here

0.0.82

6 years ago

0.0.81

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.62

6 years ago

0.0.61

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago