![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@rescui/use-resize-observer
Advanced tools
This package is used for observing react elements.
It uses ResizeObserver
and alleviates some of its bugs.
It's best used together with React refs. It can be used with raw HTML
elements, although it's better to avoid that.
import React, { useRef } from 'react';
import { useResizeObserver } from '@rescui/use-resize-observer';
const MyComponent = () => {
const ref = useRef<HTMLElement>(null);
useResizeObserver(ref, (entry: ResizeObserverEntry) => {
// resize logic
});
return <div ref={ref}>To the moon!</div>;
};
Note: Avoid this option when possible due to additional re-renders when using callback refs and useState
. Use React ref instead.
import React, { useState } from 'react';
import { useResizeObserver } from '@rescui/use-resize-observer';
const MyComponent = () => {
const [el, setEl] = useState<HTMLElement>(null);
useResizeObserver(el, (entry: ResizeObserverEntry) => {
// resize logic
});
return <div ref={setEl}>To the moon!</div>;
};
Sometimes you need to observe only changes and ignore the first observer call.
In that case, you may use the ignoreFirstCall
option:
import React, { useState } from 'react';
import { useResizeObserver } from '@rescui/use-resize-observer';
const MyComponent = () => {
const ref = useRef<HTMLElement>(null);
useResizeObserver(
ref,
(entry: ResizeObserverEntry) => {
// resize logic
},
{ ignoreFirstCall: true }
);
return <div ref={ref}>To the moon!</div>;
};
FAQs
ResizeObserver hook
The npm package @rescui/use-resize-observer receives a total of 1,591 weekly downloads. As such, @rescui/use-resize-observer popularity was classified as popular.
We found that @rescui/use-resize-observer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.