1.3.5 • Published 5 years ago

react-hook-size v1.3.5

Weekly downloads
954
License
ISC
Repository
github
Last release
5 years ago

Instalation

npm i react-hook-size --save

Why this hook is the best?

  • Rerenders after mount to get size
  • Uses ResizeObserver(or ponyfill)

Usage

import React, { useRef } from 'react';
import { useSize } from 'react-hook-size';

export default function Example() {
    
    let style = {
        width: '100%',
        height: '100%',
    };
    let ref = useRef();
    let { width, height } = useSize(ref);

    return (
        <div ref={ref} style={style}>
            <h1>W: {width}, H: {height}</h1>
        </div>
    );
}
1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago