Skip to content

Commit 80506b7

Browse files
committed
feat(no-initialize-state): advise to prefer useSyncExternalStore for SSR components
#33
1 parent 24d5a2d commit 80506b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/no-initialize-state.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ export default {
1616
type: "suggestion",
1717
docs: {
1818
description: "Disallow initializing state in an effect.",
19+
url: "https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store",
1920
},
2021
schema: [],
2122
messages: {
2223
avoidInitializingState:
23-
'Avoid initializing state in an effect. Instead, pass "{{state}}"\'s initial value to its `useState`.',
24+
'Avoid initializing state in an effect. Instead, pass "{{state}}"\'s initial value to its `useState`. For SSR hydration, prefer `useSyncExternalStore`.',
2425
},
2526
},
2627
create: (context) => ({

0 commit comments

Comments
 (0)