Skip to content

Commit

Permalink
Merge branch 'main' into more-memory-leak-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Apr 16, 2024
2 parents 211ac24 + 3d98818 commit 6ab9503
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions docs/tools/devtools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords: devtools,debug,snapshot
Install `jotai-devtools` to your project to get started.

```sh
npm i jotai-devtools @emotion/react
npm i jotai-devtools
```

### Notes
Expand All @@ -28,6 +28,8 @@ npm i jotai-devtools @emotion/react
- [useAtomsDevtools](#useatomsdevtools)
- [useAtomsSnapshot](#useatomssnapshot)
- [useGotoAtomsSnapshot](#usegotoatomssnapshot)
- Migration guides
- [Migrate from `@emotion/react`](https://github.com/jotaijs/jotai-devtools?tab=readme-ov-file#migrate-%C6%92rom-emotionreact-to-native-css)

### UI DevTools

Expand Down Expand Up @@ -122,6 +124,7 @@ type DevToolsProps = {
```tsx
import { DevTools } from 'jotai-devtools'
import 'jotai-devtools/styles.css'

const App = () => {
return (
Expand All @@ -138,6 +141,7 @@ const App = () => {
```tsx
import { createStore } from 'jotai'
import { DevTools } from 'jotai-devtools'
import 'jotai-devtools/styles.css'

const customStore = createStore()

Expand Down Expand Up @@ -172,7 +176,7 @@ It will catch all atoms that are accessible from the place the hook is located.
### Example

```jsx
import { useAtomsDebugValue } from 'jotai-devtools'
import { useAtomsDebugValue } from 'jotai-devtools/utils'
const textAtom = atom('hello')
textAtom.debugLabel = 'textAtom'
Expand Down Expand Up @@ -226,7 +230,7 @@ The `useAtomDevtools` hook accepts a generic type parameter (mirroring the type
### Example

```ts
import { useAtomDevtools } from 'jotai-devtools'
import { useAtomDevtools } from 'jotai-devtools/utils'
// The interface for the type stored in the atom.
export interface Task {
Expand Down Expand Up @@ -322,7 +326,7 @@ Be careful using this hook because it will cause the component to re-render for

```jsx
import { Provider } from 'jotai'
import { useAtomsSnapshot } from 'jotai-devtools'
import { useAtomsSnapshot } from 'jotai-devtools/utils'
const RegisteredAtoms = () => {
const atoms = useAtomsSnapshot()
Expand Down Expand Up @@ -365,7 +369,7 @@ This hook is primarily meant for debugging and devtools use cases.

```jsx
import { Provider } from 'jotai'
import { useAtomsSnapshot, useGotoAtomsSnapshot } from 'jotai-devtools'
import { useAtomsSnapshot, useGotoAtomsSnapshot } from 'jotai-devtools/utils'
const petAtom = atom('cat')
const colorAtom = atom('blue')
Expand Down
2 changes: 1 addition & 1 deletion docs/utilities/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Usage:
```js
const storage = createJSONStorage(
// getStringStorage
() => localStorage, // or sesseionStorage, asyncStorage or alike
() => localStorage, // or sessionStorage, asyncStorage or alike
// options (optional)
{
reviver, // optional reviver option for JSON.parse
Expand Down

0 comments on commit 6ab9503

Please sign in to comment.