use-dynamic-size

1.0.3 • Public • Published

Dynamic Size

This package can be used get the window size dynamically as a state to change the contents of your React App as screen resizes.

Example of this package is here. You can see width and height changing as you resize the browser window.

Installation

npm i use-dynamic-size
yarn add use-dynamic-size

Code Example

import {useDynamicSize} from "use-dynamic-size";

const Example = () => {
  const [width, height] = useDynamicSize();

  return (
    <div>
      <p>Width: {width}</p>
      <p>Height: {height}</p>
    </div>
  );
};

export default Example;

You can use this package to render different JSX components based on the screen size to make the code compatible for various screen sizes.

Readme

Keywords

Package Sidebar

Install

npm i use-dynamic-size

Weekly Downloads

8

Version

1.0.3

License

MIT

Unpacked Size

4.76 kB

Total Files

5

Last publish

Collaborators

  • heysadboy