Skip to content

Commit 8a19819

Browse files
committed
improve changeset
1 parent fe5dec3 commit 8a19819

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.changeset/honest-peas-peel.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@
22
"eslint-plugin-react-server-components": minor
33
---
44

5-
Making window check more robust to not require "use client" when safely accessed behind a `typeof window !== undefined` check
5+
Making checks for window usage more robust to not require "use client" when safely accessed behind a `typeof window !== 'undefined'` or `typeof document !== 'undefined'`check.
6+
7+
For example:
8+
```
9+
const HREF = typeof window !== 'undefined' ? window.location.href : '';
10+
11+
const MyComponent = () => {
12+
return <div>{HREF}</div>;
13+
}
14+
```
15+
does not need to be marked with a "use client" because all of it's client only actions are behind a server check.

0 commit comments

Comments
 (0)