Skip to content

Commit

Permalink
feat: 🎸 mock useMeasure() hook on server and w/o ResizeObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 16, 2020
1 parent a164843 commit 866f3d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/useMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ const useMeasure = (): UseMeasureResult => {
return [ref, rect];
};

export default useMeasure;
const useMeasureMock = () => [() => {}, defaultState];

export default !!(window as any).ResizeObserver ? useMeasure : useMeasureMock;

0 comments on commit 866f3d7

Please sign in to comment.