Skip to content

Commit 9c0be78

Browse files
committed
README: import React no longer needed in 17.x
1 parent c7fabfc commit 9c0be78

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ npm install -D use-viewport-sizes
3434
*registers dimension changes on every resize event immediately*
3535

3636
```js
37-
import React from 'react'
3837
import useViewportSizes from 'use-viewport-sizes'
3938

4039
function MyComponent(props) {
@@ -52,7 +51,6 @@ The only dimension returned in the return array value will be the width or heigh
5251
to what was passed.
5352

5453
```js
55-
import React from 'react';
5654
import useViewportSizes from 'use-viewport-sizes';
5755

5856
function MyComponent(props) {
@@ -72,7 +70,6 @@ This is useful for listening to expensive components such as data grids which ma
7270
expensive to re-render during window resize dragging.
7371

7472
```js
75-
import React from 'react';
7673
import useViewportSizes from 'use-viewport-sizes';
7774

7875
function MyExpensivelyRenderedComponent(props) {
@@ -88,7 +85,6 @@ If passed `options.debounceTimeout`, dimension changes are registered only when
8885
important to update viewport the entire way that a user is resizing.
8986

9087
```js
91-
import React from 'react';
9288
import useViewportSizes from 'use-viewport-sizes';
9389

9490
function MyExpensivelyRenderedComponent(props) {
@@ -102,7 +98,6 @@ function MyExpensivelyRenderedComponent(props) {
10298
If passed an `options.hasher` function, this will be used to calculate a hash that only updates the viewport when the calculation changes. In the example here, we are using it to detect when we have a breakpoint change which may change how a component is rendered if this is not fully possible or inconvenient via CSS `@media` queries. The hash will also be available as the 3rd value returned from the hook for convenience.
10399

104100
```js
105-
import React from 'react';
106101
import useViewportSizes from 'use-viewport-sizes';
107102

108103
function getBreakpointHash({ vpW, vpH }) {
@@ -137,7 +132,7 @@ function MyBreakpointBehaviorComponent() {
137132
*Sidenote that you will see a `useLayoutEffect` warning from React. This is perfectly expected as there is no viewport/context to paint to when pre-rendering in SSR and will not interfere with your app once served to the client*
138133

139134
```js
140-
import React, { useLayoutEffect } from 'react'
135+
import { useLayoutEffect } from 'react'
141136
import useViewportSizes from 'use-viewport-sizes'
142137

143138
function MySSRComponent (props) {

0 commit comments

Comments
 (0)