# use-respo

> useful react hook for responsive design

Latest version **1.2.1** (published 2021-09-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install use-respo
pnpm add use-respo
yarn add use-respo
bun add use-respo
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-09-09 |
| First published | 2021-08-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | amirhosein kheirallahzadeh |
| Maintainers | mrdexign |

## Links

- npm: https://www.npmjs.com/package/use-respo
- Repository: https://github.com/mrdexign/use-respo
- Homepage: https://github.com/mrdexign/use-respo#readme
- Issues: https://github.com/mrdexign/use-respo/issues
- npm.io page: https://npm.io/package/use-respo

## Recent versions

- 1.2.1 (latest) — 2021-09-09
- 1.2.0 — 2021-09-09
- 1.1.32 — 2021-08-27
- 1.1.31 — 2021-08-27
- 1.1.3 — 2021-08-27
- 1.1.2 — 2021-08-27
- 1.1.1 — 2021-08-27
- 1.1.0 — 2021-08-27
- 1.0.20 — 2021-08-27
- 1.0.19 — 2021-08-27
- 1.0.18 — 2021-08-27
- 1.0.16 — 2021-08-27
- 1.0.13 — 2021-08-27
- 1.0.12 — 2021-08-27
- 1.0.10 — 2021-08-27
- … 9 more at https://npm.io/package/use-respo/versions

## README

# useRespo

## A useful react hook for building responsive web pages

It's fast & it's very easy to use :))

# How to use ?

First , install it :

```bash
yarn install use-respo
```

Or if you prefer npm :

```bash
npm i use-respo
```

Then use it like a charm :

```js
import React from 'react';
import useRespo from 'use-respo';

const App = () => {
	const { Tiny, Mobile, Tablet, Laptop, Tv } = useRespo();
	return (
		<div>
			<Laptop>Laptop screen ONLY</Laptop>

			<Laptop up>larger than Laptop Screen size</Laptop>

			<Laptop down>smaller than Laptop Screen size</Laptop>
		</div>
	);
};

export default App;
```

> Use "up" or "down" attributes to show content in a larger or smaller size than the device you choose

You can use below components like the example above

-   Tiny
-   Mobile
-   Tablet
-   Laptop
-   Tv

# Ide suggestion

Use ide suggestion for faster development

![hello](https://github.com/mrdexign/use-respo/blob/main/images/1.png)

![hello](https://github.com/mrdexign/use-respo/blob/main/images/2.png)

# Customization

## Breakpoints

Default break point sizes are :

```js
{ xs: 0, sm: 410, md: 960, lg: 1280, xl: 1800 }
```

You can define your custom sizes like this:

```js
const { Laptop } = useRespo({ xs: 0, sm: 480, md: 790, lg: 1100, xl: 1900 });
```

Or create your custom hook like this :

```js
const myCustomBreakPoints = { xs: 0, sm: 480, md: 790, lg: 1100, xl: 1900 };

const useCustomRespo = useRespo.bind(null, myCustomBreakPoints);

const { Laptop } = useCustomRespo();
```

## onDown & onUp callbacks

Call your custom function if the device breakpoint breaks

```js
<Laptop
	onDown={() => {
		console.log('down');
	}}
	onUp={() => {
		console.log('up');
	}}
/>
```

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