
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
use-responsive-dimension
Advanced tools
This is a simple responsive dimension calculator. It calculates the dimension of an element based on the width of the parent element and the aspect ratio of the element.
npm install use-responsive-dimension
yarn add use-responsive-dimension
pnpm add use-responsive-dimension
import React from 'react';
function IframeContainer() {
const outerContainerRef = React.useRef(null);
const innerContainerRef = React.useRef(null);
const iframeRef = React.useRef(null);
return (
<div ref={outerContainerRef} style={{ width: '100%', height: '100vh' }}>
<div ref={innerContainerRef}>
<iframe ref={iframeRef} src="https://www.example.com/" />
</div>
</div>
);
}
useResponsiveDimension hook and use it.import React from 'react';
function IframeContainer() {
const outerContainerRef = React.useRef(null);
const innerContainerRef = React.useRef(null);
const iframeRef = React.useRef(null);
const { resetDimension, updateDimension, updateZoom } =
useResponsiveDimension(outerContainerRef, innerContainerRef, iframeRef);
return (
<div ref={outerContainerRef} style={{ width: '100%', height: '100vh' }}>
<div ref={innerContainerRef}>
<iframe ref={iframeRef} src="https://www.example.com/" />
</div>
</div>
);
}
Now, you can use the resetDimension, updateDimension and updateZoom functions to calculate the dimension of the iframe element. They update the dimension of the iframe and the inner container automatically.
TBD
TBD
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
The responsive dimension hook for React.
The npm package use-responsive-dimension receives a total of 0 weekly downloads. As such, use-responsive-dimension popularity was classified as not popular.
We found that use-responsive-dimension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.