Skip to content

Commit

Permalink
fix(docs): update jotai-scope v0.4.0 usage (#2206)
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Oct 24, 2023
1 parent 075bd5b commit 2857b42
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions docs/integrations/scope.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ yarn add jotai-scope
### Counter Example

```tsx
import { atom } from 'jotai'
import { ScopeProvider, useAtom } from 'jotai-scope'
import { atom, useAtom } from 'jotai'
import { ScopeProvider } from 'jotai-scope'

const countAtom = atom(0)
const anotherCountAtom = atom(0)
Expand All @@ -55,21 +55,23 @@ const Counter = () => {
)
}

const App = () => (
<div>
<h1>First Provider</h1>
<ScopeProvider atoms={[anotherCountAtom]}>
<Counter />
</ScopeProvider>
<h1>Second Provider</h1>
<ScopeProvider atoms={[anotherCountAtom]}>
<Counter />
</ScopeProvider>
</div>
)
const App = () => {
return (
<div>
<h1>First Provider</h1>
<ScopeProvider atoms={[anotherCountAtom]}>
<Counter />
</ScopeProvider>
<h1>Second Provider</h1>
<ScopeProvider atoms={[anotherCountAtom]}>
<Counter />
</ScopeProvider>
</div>
)
}
```

<CodeSandbox id="nmmnrh" />
<CodeSandbox id="rf3r4n" />

## `createIsolation`

Expand Down

1 comment on commit 2857b42

@vercel
Copy link

@vercel vercel bot commented on 2857b42 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.