Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

scandindian/use-dynamic-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published