Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.
/ useInView Public archive

React hook, check if a component is in viewport.

License

Notifications You must be signed in to change notification settings

codeashian/useInView

Repository files navigation

useInView

Check if your component is in viewport using this simple hook!

Build Status code style: prettier GitHub top language npm bundle size (scoped) David

⭐ ⭐ Check out a working demo here ⭐ ⭐

Install

$ yarn add use-in-view

Usage

import useInView from 'use-in-view';

const AnimatedComponent = () => {
	const offset = 30;
	const [ref, inView] = useInView(offset);

	return (
		<div className={`${inView && 'in-view'}`} ref={ref}>
			Animate me!
		</div>
	);
};

About

React hook, check if a component is in viewport.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published