diff --git a/docs/basics/comparison.mdx b/docs/basics/comparison.mdx
index 6268989f73..0cad21f20d 100644
--- a/docs/basics/comparison.mdx
+++ b/docs/basics/comparison.mdx
@@ -1,6 +1,6 @@
---
title: Comparison
-nav: 6.02
+nav: 7.02
---
Jotai was born to solve extra re-render issues in React.
diff --git a/docs/basics/concepts.mdx b/docs/basics/concepts.mdx
index f0bc1a977b..023d70d72a 100644
--- a/docs/basics/concepts.mdx
+++ b/docs/basics/concepts.mdx
@@ -1,6 +1,6 @@
---
title: Concepts
-nav: 6.01
+nav: 7.01
---
Jotai is a library that will make you return to the basics of React development & keep everything simple.
diff --git a/docs/basics/functional-programming-and-jotai.mdx b/docs/basics/functional-programming-and-jotai.mdx
index c259d04c9b..aba091ec70 100644
--- a/docs/basics/functional-programming-and-jotai.mdx
+++ b/docs/basics/functional-programming-and-jotai.mdx
@@ -1,6 +1,6 @@
---
title: Functional programming and Jotai
-nav: 6.04
+nav: 7.04
---
### Unexpected similarities
diff --git a/docs/basics/showcase.mdx b/docs/basics/showcase.mdx
index 8de5d724cf..9c92e44721 100644
--- a/docs/basics/showcase.mdx
+++ b/docs/basics/showcase.mdx
@@ -1,6 +1,6 @@
---
title: Showcase
-nav: 6.03
+nav: 7.03
---
- Text Length example [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?style=flat-square&logo=codesandbox)](https://githubbox.com/pmndrs/jotai/tree/main/examples/text_length)
diff --git a/docs/guides/async.mdx b/docs/guides/async.mdx
index adbfbf30f4..0d8ab1bf3c 100644
--- a/docs/guides/async.mdx
+++ b/docs/guides/async.mdx
@@ -1,7 +1,7 @@
---
title: Async
description: This doc describes about the behavior with async.
-nav: 7.99
+nav: 8.99
keywords: async
published: false
---
diff --git a/docs/guides/atoms-in-atom.mdx b/docs/guides/atoms-in-atom.mdx
index b186d9dbcb..dc7bdaf852 100644
--- a/docs/guides/atoms-in-atom.mdx
+++ b/docs/guides/atoms-in-atom.mdx
@@ -1,6 +1,6 @@
---
title: Atoms in atom
-nav: 7.12
+nav: 8.12
---
`atom()` creates an atom config, which is an object, but it doesn't hold a value.
diff --git a/docs/guides/composing-atoms.mdx b/docs/guides/composing-atoms.mdx
index 9522ba133b..8c545e5fbc 100644
--- a/docs/guides/composing-atoms.mdx
+++ b/docs/guides/composing-atoms.mdx
@@ -1,6 +1,6 @@
---
title: Composing atoms
-nav: 7.11
+nav: 8.11
---
The `atom` function provided by library is very primitive,
diff --git a/docs/guides/core-internals.mdx b/docs/guides/core-internals.mdx
index d60b03056c..f38c1d0470 100644
--- a/docs/guides/core-internals.mdx
+++ b/docs/guides/core-internals.mdx
@@ -1,7 +1,7 @@
---
title: Core internals
description: A simplified version of the core implementation
-nav: 7.10
+nav: 8.10
---
This guide is beneficial for those who want to understand the core implementation of Jotai. It's not meant to be a complete example of the
diff --git a/docs/guides/debugging.mdx b/docs/guides/debugging.mdx
index c8c9bc0335..726887f898 100644
--- a/docs/guides/debugging.mdx
+++ b/docs/guides/debugging.mdx
@@ -1,6 +1,6 @@
---
title: Debugging
-nav: 7.07
+nav: 8.07
keywords: debug,labels,devtools,freeze
---
diff --git a/docs/guides/gatsby.mdx b/docs/guides/gatsby.mdx
deleted file mode 100644
index 7a276f875b..0000000000
--- a/docs/guides/gatsby.mdx
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: Gatsby
-description: How to use Jotai with Gatsby
-nav: 7.04
-keywords: gatsby
-status: draft
----
-
-### Hydration
-
-Jotai has support for hydration of atoms with `useHydrateAtoms`. The documentation for the hook can be seen [here](../utils/ssr.mdx).
-
-### Babel plugins
-
-Jotai provides Babel plugins for better DX while developing with Gatsby. [Find more info in the Babel section.](../tools/babel.mdx)
diff --git a/docs/guides/initialize-atom-on-render.mdx b/docs/guides/initialize-atom-on-render.mdx
index 98fc9e20af..ac889cfda8 100644
--- a/docs/guides/initialize-atom-on-render.mdx
+++ b/docs/guides/initialize-atom-on-render.mdx
@@ -1,7 +1,7 @@
---
title: Initializing state on render
description: How to initialize atom state on initial render
-nav: 7.13
+nav: 8.13
---
There are times when you need to create an reusable component which uses atoms.
diff --git a/docs/guides/migrating-to-v2-api.mdx b/docs/guides/migrating-to-v2-api.mdx
index 8d2aa5f265..646d2de557 100644
--- a/docs/guides/migrating-to-v2-api.mdx
+++ b/docs/guides/migrating-to-v2-api.mdx
@@ -1,7 +1,7 @@
---
title: v2 API migration
description: New "Async" API
-nav: 7.0
+nav: 8.0
---
RFC: https://github.com/pmndrs/jotai/discussions/1514
diff --git a/docs/guides/nextjs.mdx b/docs/guides/nextjs.mdx
index fae0640c15..492d043bd6 100644
--- a/docs/guides/nextjs.mdx
+++ b/docs/guides/nextjs.mdx
@@ -1,7 +1,7 @@
---
title: Next.js
description: How to use Jotai with Next.js
-nav: 7.03
+nav: 8.03
keywords: next,nextjs
---
diff --git a/docs/guides/performance.mdx b/docs/guides/performance.mdx
index 8a6d364e0f..9468579a49 100644
--- a/docs/guides/performance.mdx
+++ b/docs/guides/performance.mdx
@@ -1,7 +1,7 @@
---
title: Performance
description: How to limit extra re-renders
-nav: 7.08
+nav: 8.08
keywords: performance
---
diff --git a/docs/guides/persistence.mdx b/docs/guides/persistence.mdx
index dbc03405e4..e9c95cc061 100644
--- a/docs/guides/persistence.mdx
+++ b/docs/guides/persistence.mdx
@@ -1,7 +1,7 @@
---
title: Persistence
description: How to persist atoms
-nav: 7.14
+nav: 8.14
---
Jotai has an [atomWithStorage function in the utils bundle](../utilities/storage.mdx) for persistence that supports persisting state in `sessionStorage`, `localStorage`, `AsyncStorage`, or the URL hash.
diff --git a/docs/guides/react-native.mdx b/docs/guides/react-native.mdx
index 53b1cdb471..6f4925eb56 100644
--- a/docs/guides/react-native.mdx
+++ b/docs/guides/react-native.mdx
@@ -1,7 +1,7 @@
---
title: React Native
description: Using Jotai in React Native
-nav: 7.06
+nav: 8.06
keywords: native,ios,android
---
diff --git a/docs/guides/remix.mdx b/docs/guides/remix.mdx
index 1060940d99..9264176952 100644
--- a/docs/guides/remix.mdx
+++ b/docs/guides/remix.mdx
@@ -1,7 +1,7 @@
---
title: Remix
description: How to use Jotai with Remix
-nav: 7.05
+nav: 8.05
keywords: remix
status: draft
---
diff --git a/docs/guides/resettable.mdx b/docs/guides/resettable.mdx
index e21251cd66..8cee4240db 100644
--- a/docs/guides/resettable.mdx
+++ b/docs/guides/resettable.mdx
@@ -1,7 +1,7 @@
---
title: Resettable
description: How to use resettable atoms
-nav: 7.99
+nav: 8.99
published: false
---
diff --git a/docs/guides/testing.mdx b/docs/guides/testing.mdx
index 41da982993..90641820f3 100644
--- a/docs/guides/testing.mdx
+++ b/docs/guides/testing.mdx
@@ -1,7 +1,7 @@
---
title: Testing
description: How to test your code using Jotai
-nav: 7.09
+nav: 8.09
keywords: test,testing
---
diff --git a/docs/guides/typescript.mdx b/docs/guides/typescript.mdx
index aafdba7491..094070cd4c 100644
--- a/docs/guides/typescript.mdx
+++ b/docs/guides/typescript.mdx
@@ -1,7 +1,7 @@
---
title: TypeScript
description: How to use Jotai with TypeScript
-nav: 7.02
+nav: 8.02
keywords: typescript,types
---
diff --git a/docs/guides/using-store-outside-react.mdx b/docs/guides/using-store-outside-react.mdx
index d67a1d47b8..0f680bcb9e 100644
--- a/docs/guides/using-store-outside-react.mdx
+++ b/docs/guides/using-store-outside-react.mdx
@@ -1,7 +1,7 @@
---
title: Using store outside React
description: Using store outside React
-nav: 4.98
+nav: 8.98
keywords: state, outside, react
published: false
---
diff --git a/docs/guides/vite.mdx b/docs/guides/vite.mdx
index 8d0e1fcbe5..31c3490cb7 100644
--- a/docs/guides/vite.mdx
+++ b/docs/guides/vite.mdx
@@ -1,7 +1,7 @@
---
title: Vite
description: How to use Jotai with Vite
-nav: 7.99
+nav: 8.99
keywords: vite
published: false
---
diff --git a/docs/guides/waku.mdx b/docs/guides/waku.mdx
new file mode 100644
index 0000000000..4c52a97ac5
--- /dev/null
+++ b/docs/guides/waku.mdx
@@ -0,0 +1,11 @@
+---
+title: Waku
+description: How to use Jotai with Waku
+nav: 8.04
+keywords: waku
+status: draft
+---
+
+### Hydration
+
+Jotai has support for hydration of atoms with `useHydrateAtoms`. The documentation for the hook can be seen [here](../utils/ssr.mdx).
diff --git a/docs/introduction.mdx b/docs/index.mdx
similarity index 54%
rename from docs/introduction.mdx
rename to docs/index.mdx
index cbc67527fe..8d51cfb2ec 100644
--- a/docs/introduction.mdx
+++ b/docs/index.mdx
@@ -1,5 +1,5 @@
---
-title: Introduction
+title: Documentation
description: Table of contents
nav: 0
---
@@ -11,7 +11,7 @@ Welcome to the Jotai v2 documentation! Jotai's atomic approach to global React s
- Minimal core API (2kb)
- Many utilities and extensions
- TypeScript oriented
-- Works with Next.js, Gatsby, Remix, Waku, and React Native
+- Works with Next.js, Waku, Remix, and React Native
## Core
@@ -27,30 +27,36 @@ Jotai also includes a `jotai/utils` bundle with a variety of extra utility funct
## Extensions
-Jotai has separate bundles for many official extensions including `atomWithQuery` for React Query and `atomWithMachine` for XState, among many others.
+Jotai has many officially maintained extensions including `atomWithQuery` for React Query and `atomWithMachine` for XState, among many others.
+## Third-party
+
+Beyond the official extensions, there are many third-party community packages as well.
+
+
+
## Tools
-There are also SWC and Babel compiler plugins for React Fast Refresh support and debugging labels. This creates the best developer experience when using Jotai with a React framework such as Next.js or Gatsby.
+Use SWC and Babel compiler plugins for React Fast Refresh support and debugging labels. This creates the best developer experience when using a React framework such as Next.js or Waku.
## Basics
-Learn the basic concepts and primitives of the library, discover how it compares with other solutions, and see examples of it in use.
+Learn the basic concepts of the library, discover how it compares with others, and see usage examples.
## Guides
-These guides can help with use common cases such as TypeScript, React frameworks, and basic patterns.
+Guides can help with use common cases such as TypeScript, React frameworks, and basic patterns.
## Recipes
-These recipes can help with more advanced patterns.
+Recipes can help with more advanced patterns.
diff --git a/docs/recipes/atom-with-broadcast.mdx b/docs/recipes/atom-with-broadcast.mdx
index 718d52644c..6cecd7f1e1 100644
--- a/docs/recipes/atom-with-broadcast.mdx
+++ b/docs/recipes/atom-with-broadcast.mdx
@@ -1,6 +1,6 @@
---
title: atomWithBroadcast
-nav: 8.09
+nav: 9.09
keywords: creators,broadcast
---
diff --git a/docs/recipes/atom-with-compare.mdx b/docs/recipes/atom-with-compare.mdx
index 9dc574a83f..2f88c7beda 100644
--- a/docs/recipes/atom-with-compare.mdx
+++ b/docs/recipes/atom-with-compare.mdx
@@ -1,6 +1,6 @@
---
title: atomWithCompare
-nav: 8.05
+nav: 9.05
keywords: creators,compare
---
diff --git a/docs/recipes/atom-with-debounce.mdx b/docs/recipes/atom-with-debounce.mdx
index 65ba15a27b..c3dfd0a4aa 100644
--- a/docs/recipes/atom-with-debounce.mdx
+++ b/docs/recipes/atom-with-debounce.mdx
@@ -1,6 +1,6 @@
---
title: atomWithDebounce
-nav: 8.10
+nav: 9.10
keywords: creators,debounce
---
diff --git a/docs/recipes/atom-with-listeners.mdx b/docs/recipes/atom-with-listeners.mdx
index f7fde24aeb..95679c55b4 100644
--- a/docs/recipes/atom-with-listeners.mdx
+++ b/docs/recipes/atom-with-listeners.mdx
@@ -1,6 +1,6 @@
---
title: atomWithListeners
-nav: 8.08
+nav: 9.08
keywords: creators,listeners
---
diff --git a/docs/recipes/atom-with-refresh-and-default.mdx b/docs/recipes/atom-with-refresh-and-default.mdx
index ce40565b23..d46533c969 100644
--- a/docs/recipes/atom-with-refresh-and-default.mdx
+++ b/docs/recipes/atom-with-refresh-and-default.mdx
@@ -1,6 +1,6 @@
---
title: atomWithRefreshAndDefault
-nav: 8.07
+nav: 9.07
keywords: creators,refresh,default
---
@@ -8,7 +8,7 @@ keywords: creators,refresh,default
### Look back to atomWithDefault behavior
-As you can see in the example code in atomWithDefault section, the two atoms' relation is disconnected after updating created one, `count2Atom = atomWithDefault((get) => get(count1Atom) * 2)`.
+As you can see in the example code in atomWithDefault section, the two atoms' relation is disconnected after updating created one, `count2Atom = atomWithDefault((get) => get(count1Atom) * 2)`.
Let's confirm what's occurred,
- 1. Click "increment count1", then count1 is 2 and count2 is 4
diff --git a/docs/recipes/atom-with-refresh.mdx b/docs/recipes/atom-with-refresh.mdx
index a5cfb5a516..5207716f27 100644
--- a/docs/recipes/atom-with-refresh.mdx
+++ b/docs/recipes/atom-with-refresh.mdx
@@ -1,6 +1,6 @@
---
title: atomWithRefresh
-nav: 8.06
+nav: 9.06
keywords: creators,refresh
---
diff --git a/docs/recipes/atom-with-toggle-and-storage.mdx b/docs/recipes/atom-with-toggle-and-storage.mdx
index 7b3554aed1..8e64585212 100644
--- a/docs/recipes/atom-with-toggle-and-storage.mdx
+++ b/docs/recipes/atom-with-toggle-and-storage.mdx
@@ -1,6 +1,6 @@
---
title: atomWithToggleAndStorage
-nav: 8.05
+nav: 9.05
keywords: creators,storage
---
diff --git a/docs/recipes/atom-with-toggle.mdx b/docs/recipes/atom-with-toggle.mdx
index 3c5bda9917..2b1198f1bd 100644
--- a/docs/recipes/atom-with-toggle.mdx
+++ b/docs/recipes/atom-with-toggle.mdx
@@ -1,6 +1,6 @@
---
title: atomWithToggle
-nav: 8.04
+nav: 9.04
keywords: creators,toggle
---
diff --git a/docs/recipes/custom-useatom-hooks.mdx b/docs/recipes/custom-useatom-hooks.mdx
index 55cbd6017c..fa83d29039 100644
--- a/docs/recipes/custom-useatom-hooks.mdx
+++ b/docs/recipes/custom-useatom-hooks.mdx
@@ -1,6 +1,6 @@
---
title: Custom useAtom hooks
-nav: 8.02
+nav: 9.02
keywords: custom,hook
---
diff --git a/docs/recipes/large-objects.mdx b/docs/recipes/large-objects.mdx
index b855d35bfb..9a95f505c9 100644
--- a/docs/recipes/large-objects.mdx
+++ b/docs/recipes/large-objects.mdx
@@ -1,6 +1,6 @@
---
title: Large objects
-nav: 8.01
+nav: 9.01
keywords: large,object
---
diff --git a/docs/recipes/use-atom-effect.mdx b/docs/recipes/use-atom-effect.mdx
index c442d5db98..2f9e8910fc 100644
--- a/docs/recipes/use-atom-effect.mdx
+++ b/docs/recipes/use-atom-effect.mdx
@@ -1,6 +1,6 @@
---
title: useAtomEffect
-nav: 8.03
+nav: 9.03
keywords: effect, atom effect, side effect, side-effect, sideeffect, hook, useAtomEffect
---
diff --git a/docs/recipes/use-reducer-atom.mdx b/docs/recipes/use-reducer-atom.mdx
index 9253f7d8ec..090d68ae3c 100644
--- a/docs/recipes/use-reducer-atom.mdx
+++ b/docs/recipes/use-reducer-atom.mdx
@@ -1,6 +1,6 @@
---
title: useReducerAtom
-nav: 8.11
+nav: 9.11
keywords: reducer, hook, useReducerAtom
---
diff --git a/docs/tools/babel.mdx b/docs/tools/babel.mdx
index fcab9e3570..bff8e3a0bc 100644
--- a/docs/tools/babel.mdx
+++ b/docs/tools/babel.mdx
@@ -1,7 +1,7 @@
---
title: Babel
description: This doc describes the `jotai/babel` bundle.
-nav: 5.02
+nav: 6.02
keywords: babel,gatsby,fast,refresh
---
diff --git a/docs/tools/devtools.mdx b/docs/tools/devtools.mdx
index 5af0078a56..9c9c062385 100644
--- a/docs/tools/devtools.mdx
+++ b/docs/tools/devtools.mdx
@@ -1,7 +1,7 @@
---
title: Devtools
description: This doc describes Devtools for Jotai.
-nav: 5.03
+nav: 6.03
keywords: devtools,debug,snapshot
---
diff --git a/docs/tools/swc.mdx b/docs/tools/swc.mdx
index de7e5b7cd3..21277e8f7f 100644
--- a/docs/tools/swc.mdx
+++ b/docs/tools/swc.mdx
@@ -1,7 +1,7 @@
---
title: SWC
description: This doc describes SWC plugins for Jotai.
-nav: 5.01
+nav: 6.01
keywords: swc,next,nextjs,fast,refresh
---
diff --git a/website/gatsby-node.js b/website/gatsby-node.js
index df5ac2383b..aa2365cbe7 100644
--- a/website/gatsby-node.js
+++ b/website/gatsby-node.js
@@ -1,6 +1,22 @@
exports.createPages = ({ actions }) => {
const { createRedirect } = actions;
+ actions.setWebpackConfig({
+ module: {
+ rules: [
+ {
+ test: require.resolve(`@gatsbyjs/reach-router/index`),
+ type: `javascript/auto`,
+ use: [
+ {
+ loader: require.resolve(`./reach-router`),
+ },
+ ],
+ },
+ ],
+ },
+ });
+
createRedirect({
fromPath: `/docs`,
toPath: `/docs/introduction`,
diff --git a/website/package.json b/website/package.json
index a992816f83..8af226eb32 100644
--- a/website/package.json
+++ b/website/package.json
@@ -42,6 +42,7 @@
"react-remove-scroll": "^2.5.5"
},
"devDependencies": {
+ "@gatsbyjs/reach-router": "^2.0.1",
"@tailwindcss/forms": "^0.5.6",
"autoprefixer": "^10.4.11",
"babel-core": "^6.26.3",
diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml
index 6b1a612351..56557a2950 100644
--- a/website/pnpm-lock.yaml
+++ b/website/pnpm-lock.yaml
@@ -73,6 +73,9 @@ dependencies:
version: 2.5.9(react@18.3.1)
devDependencies:
+ '@gatsbyjs/reach-router':
+ specifier: ^2.0.1
+ version: 2.0.1(react-dom@18.3.1)(react@18.3.1)
'@tailwindcss/forms':
specifier: ^0.5.6
version: 0.5.7(tailwindcss@3.4.3)
@@ -1688,6 +1691,18 @@ packages:
react-lifecycles-compat: 3.0.4
dev: false
+ /@gatsbyjs/reach-router@2.0.1(react-dom@18.3.1)(react@18.3.1):
+ resolution: {integrity: sha512-gmSZniS9/phwgEgpFARMpNg21PkYDZEpfgEzvkgpE/iku4uvXqCrxr86fXbTpI9mkrhKS1SCTYmLGe60VdHcdQ==}
+ peerDependencies:
+ react: 18.x
+ react-dom: 18.x
+ dependencies:
+ invariant: 2.2.4
+ prop-types: 15.8.1
+ react: 18.3.1
+ react-dom: 18.3.1(react@18.3.1)
+ dev: true
+
/@gatsbyjs/webpack-hot-middleware@2.25.3:
resolution: {integrity: sha512-ul17OZ8Dlw+ATRbnuU+kwxuAlq9lKbYz/2uBS1FLCdgoPTF1H2heP7HbUbgfMZbfRQNcCG2rMscMnr32ritCDw==}
dependencies:
@@ -10344,7 +10359,6 @@ packages:
loose-envify: 1.4.0
object-assign: 4.1.1
react-is: 16.13.1
- dev: false
/proper-lockfile@4.1.2:
resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==}
@@ -10523,7 +10537,6 @@ packages:
loose-envify: 1.4.0
react: 18.3.1
scheduler: 0.23.2
- dev: false
/react-error-overlay@6.0.11:
resolution: {integrity: sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==}
@@ -10562,7 +10575,6 @@ packages:
/react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
- dev: false
/react-lifecycles-compat@3.0.4:
resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==}
@@ -10641,7 +10653,6 @@ packages:
engines: {node: '>=0.10.0'}
dependencies:
loose-envify: 1.4.0
- dev: false
/read-cache@1.0.0:
resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==}
@@ -11092,7 +11103,6 @@ packages:
resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
dependencies:
loose-envify: 1.4.0
- dev: false
/schema-utils@2.7.0:
resolution: {integrity: sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==}
diff --git a/website/reach-router.js b/website/reach-router.js
new file mode 100644
index 0000000000..9f0e6063eb
--- /dev/null
+++ b/website/reach-router.js
@@ -0,0 +1,7 @@
+exports.default = function (source) {
+ if (source.includes('exports.BaseContext')) {
+ return source;
+ } else {
+ return source + 'exports.BaseContext = BaseContext;';
+ }
+};
diff --git a/website/src/components/sidebar.js b/website/src/components/sidebar.js
index 16df36e7e6..b9f824ceac 100644
--- a/website/src/components/sidebar.js
+++ b/website/src/components/sidebar.js
@@ -15,20 +15,9 @@ export const Sidebar = ({ showDocs = false }) => {
- {showDocs ? (
-
- ) : (
-
- )}
- {showDocs && (
-
-
-
- )}
+
@@ -38,13 +27,28 @@ export const Sidebar = ({ showDocs = false }) => {
-
diff --git a/website/src/components/toc.js b/website/src/components/toc.js
index 480196ac10..3c34232d91 100644
--- a/website/src/components/toc.js
+++ b/website/src/components/toc.js
@@ -8,13 +8,13 @@ export const TOC = ({ section = '' }) => {
const sectionLinks = parseDocs(docs, section);
return (
-
- {sectionLinks.map((sectionLink) => (
+
+ {sectionLinks?.map((sectionLink) => (
{
];
});
- newDocs = newDocs.find((docSection) => docSection.title === section).contents;
+ newDocs = newDocs.find((docSection) => docSection.title === section)?.contents;
return newDocs;
};
diff --git a/website/src/pages/docs/{Mdx.slug}.js b/website/src/pages/docs/{Mdx.slug}.js
index 0a854896fb..d672190c8c 100644
--- a/website/src/pages/docs/{Mdx.slug}.js
+++ b/website/src/pages/docs/{Mdx.slug}.js
@@ -12,8 +12,10 @@ export default function DocsPage({ data }) {
-
{title}
-
{body}
+
{title}
+
+ {body}
+
>
);
}
diff --git a/website/src/pages/index.js b/website/src/pages/index.js
index c0c3663fc6..6360c8c66f 100644
--- a/website/src/pages/index.js
+++ b/website/src/pages/index.js
@@ -14,7 +14,7 @@ export default function HomePage() {
return (
<>
-
+
Introduction
Jotai takes an atomic approach to global React state management.
@@ -145,7 +145,7 @@ const countryAtom = atom('Japan')
const citiesAtom = atom(['Tokyo', 'Kyoto', 'Osaka'])
-const animeAtom = atom([
+export const animeAtom = atom([
{
title: 'Ghost in the Shell',
year: 1995,
@@ -176,6 +176,8 @@ const animeAtom = atom([
{`import { useAtom } from 'jotai'
+import { animeAtom } from './atoms'
+
const AnimeApp = () => {
const [anime, setAnime] = useAtom(animeAtom)
@@ -209,6 +211,8 @@ const AnimeApp = () => {
{`import { useAtomValue, useSetAtom } from 'jotai'
+import { animeAtom } from './atoms'
+
const AnimeList = () => {
const anime = useAtomValue(animeAtom)
diff --git a/website/vercel.json b/website/vercel.json
index 87fb7527d6..cffc75b8c9 100644
--- a/website/vercel.json
+++ b/website/vercel.json
@@ -7,8 +7,8 @@
},
"redirects": [
{
- "source": "/docs",
- "destination": "/docs/introduction",
+ "source": "/docs/introduction",
+ "destination": "/docs",
"permanent": false
},
{