# react-eq

> Element Queries for React

Latest version **0.1.3** (published 2017-09-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-eq
pnpm add react-eq
yarn add react-eq
bun add react-eq
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-09-05 |
| First published | 2017-05-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Rob Tarr |
| Maintainers | robtarr |
| Keywords | react, element-query |

## Links

- npm: https://www.npmjs.com/package/react-eq
- Repository: https://github.com/sparkbox/react-eq
- Homepage: https://github.com/sparkbox/react-eq#readme
- Issues: https://github.com/sparkbox/react-eq/issues
- npm.io page: https://npm.io/package/react-eq

## Dependencies (3)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [autobind-decorator](https://npm.io/package/autobind-decorator.md) ^1.4.1
- [custom-event-autopolyfill](https://npm.io/package/custom-event-autopolyfill.md) ^0.1.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2017-09-05
- 0.1.2 — 2017-08-29
- 0.1.1 — 2017-08-28
- 0.1.0 — 2017-08-25
- 0.0.4 — 2017-06-19
- 0.0.3 — 2017-06-12
- 0.0.2 — 2017-06-08
- 0.0.1 — 2017-06-08
- 0.0.0 — 2017-05-23

## README

# React Element Queries

__NOTE: This is a very early beta.__

We liked the way that https://github.com/Snugug/eq.js handled element queries, but we needed something that would work inside of our React components. This implements a similar interface to his implementation.

Usage:
```
<ElementQuery queries={{ medium: 600, large: 900 }} >
  <div>
    ◻️ ◽️ ◼︎ I'll act differently at 600px and 900px. ◼︎ ◽️ ◻️
  </div>
</ElementQuery>
```

Result when 600px <= element width < 900px:
```
<div data-eq-state="medium">
  ◻️ ◽️ ◼︎ I'll act differently at 600px and 900px. ◼︎ ◽️ ◻️
</div>
```

Result when element width >= 900px:
```
<div data-eq-state="medium large">
  ◻️ ◽️ ◼︎ I'll act differently at 600px and 900px. ◼︎ ◽️ ◻️
</div>
```

## Events:

When `data-eq-state` is updated, it will trigger a `eq-update` event on the `div`. This event will bubble up to the `window`.

---
_Source: https://npm.io/package/react-eq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
