A smart store for Nano Stores state manager to sync with some media query.
- Small. from 84 bytes (minified and brotlied). Zero dependencies. It uses Size Limit to control size.
- It has good TypeScript.
- Framework agnostic. It supports SSR.
import { fromMediaQuery } from '@nanostores/media-query'
export const $isMobile = fromMediaQuery('(max-width: 600px)')
Made at Evil Martians, product consulting for developer tools.
npm install nanostores @nanostores/media-query
See Nano Stores docs about using the store and subscribing to store’s changes in UI frameworks.
You can degine store values:
export const $isMobile = fromMediaQuery('(max-width: 600px)', 'yes', 'no')