0.0.5 • Published 5 years ago

@realdennis/use-resize v0.0.5

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

useResize

Get window size by hooks resize event without side-effect.

How to use?

import useResize from '@realdennis/use-reize';
const demo = ()=>{
  const size = useResize();
  return <p>{`width: ${size.width} / height: ${size:height}`}</p>
}

What I Do?

Call clean-up function (to removeEventListener) when component has been unmounted.

Why This has a dependency of useEventTarget

This is a hooks infrastructure for easily package a event hooks.

See more useEventTarget.