1.2.1 • Published 3 years ago

use-respo v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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

3 years ago

1.2.1

3 years ago

1.1.32

3 years ago

1.1.31

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.16

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago