diff --git a/docs/docs/advanced/batching.mdx b/docs/docs/advanced/batching.mdx index 37ffb17d..9e4e2232 100644 --- a/docs/docs/advanced/batching.mdx +++ b/docs/docs/advanced/batching.mdx @@ -85,12 +85,15 @@ const manualBatchingAtom = atom('manualBatching', () => { // use `injectMemo` to "turn off" automatic batching: // highlight-next-line - const updateTwice = injectMemo(() => { - ecosystem.batch(() => { - store.setState(state => state + 1) - store.setState(state => state + 1) - }) - }, []) + const updateTwice = injectMemo( + () => () => { + ecosystem.batch(() => { + store.setState(state => state + 1) + store.setState(state => state + 1) + }) + }, + [] + ) return api(store).setExports({ updateTwice }) })