Skip to content

Commit

Permalink
docs: fix useResizeObserver example
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Jun 30, 2021
1 parent c26b8c1 commit c4fb6bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/useResizeObserver/__docs__/example.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ export const Example: React.FC = () => {
export const ExampleDebounced: React.FC = () => {
const ref = useRef<HTMLDivElement | null>(null);
const [rect, setRect] = useState<DOMRectReadOnly>();
const cb = useDebouncedCallback<IUseResizeObserverCallback>((e) => setRect(e.contentRect), 500, [
setRect,
]);
const cb = useDebouncedCallback(
((e) => setRect(e.contentRect)) as IUseResizeObserverCallback,
[setRect],
500
);
useResizeObserver(ref, cb);

return (
Expand Down

0 comments on commit c4fb6bd

Please sign in to comment.