Skip to content

Commit 614bf5f

Browse files
Fix saving URL hash example demo (#1800)
1 parent 65d2bc0 commit 614bf5f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/guides/connect-to-state-with-url-hash.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const hashStorage: StateStorage = {
1515
getItem: (key): string => {
1616
const searchParams = new URLSearchParams(location.hash.slice(1))
1717
const storedValue = searchParams.get(key) ?? ''
18-
return storedValue
18+
return JSON.parse(storedValue)
1919
},
2020
setItem: (key, newValue): void => {
2121
const searchParams = new URLSearchParams(location.hash.slice(1))
@@ -45,4 +45,4 @@ export const useBoundStore = create(
4545

4646
## CodeSandbox Demo
4747

48-
https://codesandbox.io/s/zustand-state-with-url-hash-demo-pn20n5?file=/src/store/index.ts
48+
https://codesandbox.io/s/zustand-state-with-url-hash-demo-f29b88?file=/src/store/index.ts

0 commit comments

Comments
 (0)