You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,11 +16,11 @@ Modern browsers now have native support for detecting element size changes throu
16
16
17
17
No `window.resize` listeners! No timeouts!
18
18
19
-
## Is it necessary for you to use this library?
19
+
## Should you use this library?
20
20
21
-
Container queries now work in [all major browsers](https://caniuse.com/css-container-queries). It's very likely you can solve your task using [pure CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries).
21
+
**Consider CSS Container Queries first!** They now work in [all major browsers](https://caniuse.com/css-container-queries) and might solve your use case with pure CSS.
|`observerOptions`|`ResizeObserverOptions`| Options passed to [`resizeObserver.observe`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe)|`undefined`|
144
+
|`targetRef`|`MutableRefObject<T \| null>`| External ref to observe (use with caution) |`undefined`|
| skipOnMount | Bool | Do not trigger onResize when a component mounts |`false`|
116
-
| refreshMode | String | Possible values: `throttle` and `debounce` See [lodash docs](https://lodash.com/docs#debounce) for more information. `undefined` - callback will be fired for every frame |`undefined`|
117
-
| refreshRate | Number | Use this in conjunction with `refreshMode`. Important! It's a numeric prop so set it accordingly, e.g. `refreshRate={500}`|`1000`|
118
-
| refreshOptions | Object | Use this in conjunction with `refreshMode`. An object in shape of `{ leading: bool, trailing: bool }`. Please refer to [lodash's docs](https://lodash.com/docs/4.17.11#throttle) for more info |`undefined`|
119
-
| observerOptions | Object | These options will be used as a second parameter of [`resizeObserver.observe`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe) method. |`undefined`|
120
-
| targetRef | Ref | Use this prop to pass a reference to the element you want to attach resize handlers to. It must be an instance of `React.useRef` or `React.createRef` functions |`undefined`|
146
+
## Advanced Examples
121
147
122
-
##Testing with Enzyme and Jest
148
+
### Responsive Component
123
149
124
-
Thanks to [@Primajin](https://github.com/Primajin) for posting this [snippet](https://github.com/maslianok/react-resize-detector/issues/145)
0 commit comments