Skip to content

Commit 1e03d75

Browse files
committed
bump to 0.7.0-alpha.0, update README
1 parent 22388b0 commit 1e03d75

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

README.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm install -D use-viewport-sizes
1616
- optional debounce to delay updates until user stops dragging their window for a moment; this can make expensive components with size-dependent calculations run much faster and your app feel smoother.
1717
- debouncing does not create new handlers or waste re-renders in your component; the results are also pooled from only one resize result.
1818
- optional hash function to update component subtree only at points you would like to.
19-
- supports lazy loaded components and SSR out of the box (see example SSR under Usage section).
19+
- supports lazy loaded components and SSR out of the box.
2020

2121

2222
## Usage ##
@@ -123,29 +123,6 @@ function MyBreakpointBehaviorComponent() {
123123
}
124124
```
125125

126-
### **Server Side Rendering**
127-
128-
*Note: While serverside rendering is supported, it requires an explicit update via `useEffect` since viewport does not actually exist on the server before rendering to client. The following has been tested with [NextJS](https://nextjs.org/).*
129-
130-
*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*
131-
132-
```js
133-
import { useLayoutEffect } from 'react'
134-
import useViewportSizes from 'use-viewport-sizes'
135-
136-
function MySSRComponent (props) {
137-
const [vpW, vpH, updateVpSizes] = useViewportSizes();
138-
139-
// below, we add one post-render update
140-
// in order to register the client's viewport sizes
141-
// after serving SSR content
142-
143-
useEffect(()=> { updateVpSizes() }, []);
144-
145-
// ...renderLogic
146-
}
147-
```
148-
149126
## Support
150127
If you find any issues or would like to request something changed, please feel free to [post an issue on Github](https://github.com/rob2d/use-viewport-sizes/issues/new).
151128

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-viewport-sizes",
3-
"version": "0.6.1",
3+
"version": "0.7.0-alpha.0",
44
"description": "a tiny React hook which allows you to track visible window viewport size in your components w/ an optional debounce or custom memo function for updates for optimal rendering.",
55
"main": "./build/index.js",
66
"types": "./build/index.d.ts",

0 commit comments

Comments
 (0)