File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
// Type definitions for use-resize-observer
2
2
// Project: use-resize-observer
3
3
4
- import { RefObject } from 'react' ;
5
-
6
- export default function useResizeObserver ( ) : [ RefObject < HTMLElement > , number , number ] ;
4
+ import { RefObject } from "react" ;
7
5
6
+ export default function useResizeObserver (
7
+ defaultWidth ?: number ,
8
+ defaultHeight ?: number
9
+ ) : [ RefObject < HTMLElement > , number , number ] ;
Original file line number Diff line number Diff line change 1
1
import { useEffect , useState , useRef } from "react" ;
2
2
import ResizeObserver from "resize-observer-polyfill" ;
3
3
4
- export default function ( ) {
4
+ export default function ( defaultWidth = 1 , defaultHeight = 1 ) {
5
5
const ref = useRef ( ) ;
6
- const [ width , changeWidth ] = useState ( 1 ) ;
7
- const [ height , changeHeight ] = useState ( 1 ) ;
6
+ const [ width , changeWidth ] = useState ( defaultWidth ) ;
7
+ const [ height , changeHeight ] = useState ( defaultHeight ) ;
8
8
9
9
useEffect ( ( ) => {
10
10
const element = ref . current ;
You can’t perform that action at this time.
0 commit comments