
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@ryvora/react-use-size
Advanced tools
📐✨ Get the width and height of a DOM element in React. Lightweight and efficient!
Hello, Dimension Detective! 🕵️♂️
The use-size hook is a specialized hook, often simpler than use-rect, focused specifically on getting the width and height of a DOM element. It usually employs a ResizeObserver to efficiently update these dimensions whenever the element resizes.
It's like having a dedicated width and height sensor for your HTML elements! 📏↔️↕️
use-size?use-size can be more lightweight than a full use-rect which might track position too.import { useSize } from '@ryvora/react-use-size'; // Hook name might vary
import React, { useRef } from 'react';
function MyResponsiveBox() {
const boxRef = useRef<HTMLDivElement>(null);
const size = useSize(boxRef);
return (
<div>
<div
ref={boxRef}
style={{
width: '75%',
minHeight: '100px',
border: '2px solid green',
padding: '10px',
resize: 'horizontal', // Make it resizable for demo
overflow: 'auto',
}}
>
Try resizing me horizontally!
{size && (
<p>
Current Width: {size.width}px, Current Height: {size.height}px
</p>
)}
{size && size.width < 300 && <p style={{ color: 'red' }}>I'm getting pretty small!</p>}
</div>
</div>
);
}
Know the dimensions, rule the layout! 👑🖼️
FAQs
📐✨ Get the width and height of a DOM element in React. Lightweight and efficient!
We found that @ryvora/react-use-size demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.