1.2.1 • Published 4 years ago

use-respo v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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 :

yarn install use-respo

Or if you prefer npm :

npm i use-respo

Then use it like a charm :

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

hello

Customization

Breakpoints

Default break point sizes are :

{ xs: 0, sm: 410, md: 960, lg: 1280, xl: 1800 }

You can define your custom sizes like this:

const { Laptop } = useRespo({ xs: 0, sm: 480, md: 790, lg: 1100, xl: 1900 });

Or create your custom hook like this :

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

<Laptop
	onDown={() => {
		console.log('down');
	}}
	onUp={() => {
		console.log('up');
	}}
/>
1.2.0

4 years ago

1.2.1

4 years ago

1.1.32

4 years ago

1.1.31

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.16

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago