Skip to content

Commit

Permalink
update local state example
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding authored Dec 11, 2019
1 parent 1533fb7 commit 95c6775
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/local-state-sharing/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import initialStore from "../libs/store"
import useSWR, { mutate } from "swr"

function Profile() {
const { data } = useSWR("globalState", () => Promise.resolve(initialStore))
const { data } = useSWR("globalState", { initialData: initialStore })
const [value, updateValue] = useState((data || {}).name)
if (!data) {
return null
Expand All @@ -29,7 +29,7 @@ function Profile() {
}

function Other() {
const { data } = useSWR("globalState", () => Promise.resolve(initialStore))
const { data } = useSWR("globalState", { initialData: initialStore })
if (!data) {
return null
}
Expand Down

0 comments on commit 95c6775

Please sign in to comment.