When I wrote React in the past and several places needed the same data, Redux came to mind immediately. Later I started encountering Jotai more often in other people's code. While building an image-editing whiteboard, I browsed Excalidraw's source and found Jotai even in something as small as opening the share dialog. 1
I was also studying newer Next.js patterns. The App Router uses React Server Components (RSC). On a product page you can render the description on the server and let the browser handle the “Add to cart” button beside it. Previously I'd probably have had both the button and header read the cart from Redux. Now, before the customer even clicks, the server-sent header already says “2 items in cart.” How does the browser know to start at two? When someone adds another item, whose number does the header follow? 23
I looked into whether the reasons to choose a state library change when both server and client render the page. Jack Herrington's Next.js course demonstrates React's built-in Context, Redux, Zustand and Jotai using the same small shop. Comparing the implementations, I kept my eye on the number on the cart. Which step does a different tool actually help with? 45
An incorrect cart count: which step went wrong?
| Symptom | Problem | Design response |
|---|---|---|
| Customer A opens the page and initially sees customer B's items | Request isolation. The server handles many people and a mutable process-wide store (an object holding state) can be read or written across requests. | Read the current user's cart. If the server needs a store, create an instance per request and keep personal data out of pages cached for all visitors. 67 |
| Page source shows two items, but the first browser render computes zero | Hydration mismatch. React is attaching events and state to existing HTML, and the initial content differs. | Generate HTML and initialize browser state from the same cart data. 38 |
| Both start at two. After an addition the panel shows three while the header shows two | State falls out of sync after takeover, also called state drift. The initial render may have been entirely correct. | Subscribe the header and panel to one cart, derive the count from its items and update that data with the server-confirmed result after submission. 910 |
Who should share the cart? When one customer opens the cart panel, the panel and header should see the same data. React Context supplies a value to descendant components. The component supplying it is a Provider. Create a cart store for the current request and pass it through a Provider so header and panel read the same instance. A store created at server module scope might also be read by the next customer. That's why Herrington's introduction says “No Global Stores.” 67
Why do Client Components appear in server-generated HTML?
Imagine directly opening a product page. With client-side rendering (CSR) the browser runs JavaScript to draw product details. With server-side rendering (SSR) the server can send HTML containing the details first, so visitors see them before interactive code finishes downloading. React then attaches the button's click behavior to the existing HTML in the browser, a step called hydration. A quantity selector's render code can generate the initial view on the server and respond to clicks in the browser, a typical example of React's isomorphic rendering. Both reuse the code but have independent memory. 118
React Server Components (RSC) divide the work further. In Next.js's App Router, which organizes pages and layouts in app/, the product description can be a component that runs only on the server. The browser receives its rendered result. The quantity selector is a Client Component with 'use client' marking its client-code entry point. On first load Next.js can prerender both into HTML. The browser takes over just the parts with client code. Server dependencies used by the description can stay on the server. 122
The dashed line encloses components the browser needs to execute. It also displays the product description, whose implementation can stay on the server.2
That gives us a concrete test for code splitting. If only the selector needs interaction, declare 'use client' in its small module. Its imports enter the client dependency scope. Move the directive up to the whole product page and display-only modules might also ship to browsers. A server-rendered description can still be passed as children to a client Provider. A heavy cart editor needed only after a click can also be lazy-loaded separately. The first decision controls which code goes to the browser, the second when it downloads. 213
Who designed RSC and ISR?
Early Next.js could already fetch data for a whole page on the server with getServerSideProps. RSC narrows the question of what executes on the server down to the component level. React's team published the research in 2020. The proposal credits Sebastian Markbåge with the initial design and cites Facebook's practice of composing client React components with PHP components, Relay and GraphQL as precedents. It describes Next.js's role explicitly: “We are partnering with Next.js to build out an initial integration.” Vercel gave design feedback. Next.js 13 later integrated RSC with App Router routing and bundling. 1412
Incremental Static Regeneration (ISR) answers another question: how many visits can reuse a generated page, and when is it regenerated after content changes? A store might statically generate a public product description (SSG) and set a revalidation interval. With time-based ISR the first visitor after that interval can still see the old description while triggering a background regeneration. Later visitors see the new version. Next.js 9.5's Pages Router already supported this. “Server sends HTML, browser takes over interaction” identifies SSR with hydration. Identifying ISR also requires checking whether pages are cached and regenerated. 15
In this store everyone can share a cacheable product description. If a customer's cart must appear on first paint, render it for that request and reuse the public product data separately. With a fully shared static product page, have the cart control load personal data separately. Regenerating a product page in the background does not push a new value into every open tab. 1610
How does the browser know the cart already contains two items?
Suppose the customer left two items in the cart last time. When they reopen the shop, the server needs to draw a 2 in the header. The browser needs the two items so it can list them when the panel opens. A server layout component Layout can call getCart() for this customer's cart and pass it to CartProvider as a prop. The server's HTML already contains 2, and the page data sent to the browser includes the same cart for initializing its own state. Herrington describes this as “the context on the server matches the context on the client”. 3
Both arrows start at the same cart. The top is the count the visitor sees. The bottom is what the browser computes at takeover.3
Replacing Context with Redux leaves the principle unchanged. Share the store factory, create a server instance for this request, and have the browser create and retain its own instance from the same initial data. If the browser renders zero from an empty array and only restores two after display, the first render has already passed through the wrong state even if the final number is correct. 78
The product description on the same page is simpler. No matter how often a customer clicks “Add to cart,” the description stays the same, so a Server Component can display it. Immutable data here means this text remains unchanged during the visit. The count changes with clicks, so next we need to see how the browser handles a modification. 63
Why does the count jump back to two after showing three?
Suppose the browser has just queried the cart. The server reads two items and its response is still in transit when the customer clicks “Add to cart.” To give immediate feedback, the UI shows three and submits the mutation to the server. Showing the expected result before confirmation is an optimistic update. Now the earlier query returns two. If every response is accepted blindly, the customer sees the header jump from three back to two.
One simple approach is to cancel older queries that might overwrite the change, remember the original value, then show three. Adopt the cart returned on server confirmation. On failure restore the original and tell the customer why. This example can wait for one addition to finish before accepting the next. If a customer can modify the cart on phone and computer simultaneously, the server must also decide how to merge changes or ask the client to retry on a version conflict. 17
The dashed line crosses the user's click. The response arrived last but contained an earlier cart.17
Why does a new review appear while the average score stays put?
On the same shop's product page an average score appears by the title, with individual reviews below. Suppose a product has one five-star review and you submit a one-star review. The new review appears in the list but the title still says five stars. Both saved successfully, so the average should be three. This happens whenever the list sees fresh data and the title still shows the number the server calculated on page load.
Have both read one review list. Server-side addReviewAction saves the new review and returns all updated reviews for the product. The browser updates the list once, and the title component recalculates its average from that same list. Unsubmitted text stays in the input's own state. Merely typing won't change the rating prematurely. 9
Reviews differ from carts in another way. Clicking from one T-shirt to another should switch the reviews but keep newly added cart items. A Provider on the product page can own that product's reviews and the shared shop layout can own the cart. To see fresh reviews from other customers, a browser query cache can store and refresh server data by product ID. For example, have the list and rating subscribe to one TanStack Query entry. If both are server-rendered, they can also be refreshed together after a successful save. 710
Which state tool fits which Next.js App Router case?
I would keep Redux. At the end of the course Herrington suggests that once Server Components are split out, the browser manages less data, so React's built-in Hooks may suffice, perhaps with a query library. I agree with that starting point. But a shop already using Redux would have to rewrite subscriptions and updates to move to Zustand or Jotai, and the stale request that replaced three with two could still happen. To decide whether to switch, identify which step a new tool actually changes. 5
Read props directly when showing only the server-confirmed count
Suppose the customer just added a third item. router.refresh() makes the server reread the cart. The same client header receives { count: 2 } and then { count: 3 }. Look at the two components' return expressions. Where does each displayed number come from? 18
'use client';
import { useState } from 'react';
export function HeaderFromProps({ cart }) {
return <span>购物车:{cart.count} 件</span>;
}
export function HeaderFromState({ cart }) {
const [localCart] = useState(cart);
return <span>购物车:{localCart.count} 件</span>;
}
At first both headers show 2 items. After refresh, HeaderFromProps reads the current cart.count prop and shows 3 items. HeaderFromState receives the new prop too, but displays localCart.count. App Router kept the component at the same position, and React preserved its state. useState(cart) uses cart only for initialization, so this header still shows 2 items. 1819
When the header only displays the confirmed count, I'd use the first version. If even that version keeps showing two, inspect the cart.count the server sent. If the server read an old cache, invalidate the relevant cache after a successful write. 1816
External stores have the same initial-render constraint. Zustand 4.5.5, for example, gives React's external-store subscription mechanism a subscribe function, a current-value reader and an initial-value reader. React reads the initial snapshot (state at that instant) during server rendering and browser hydration. After takeover it reads changes via subscription. Initialize each instance with the same cart and the first renders match. When the server later sends another cart, the application must decide when to write it into the existing instance. Jotai's useHydrateAtoms has a clear limit too: by default the same atom in the same store is initialized only once. 202122
Use React Context for UI state shared by a few components
The cart panel has two controls: a header button opens it, and a panel button closes it. Both only need the same boolean. I'd put useState in their common parent and expose reads and writes through Context. For a review draft used by the input alone, useState in that input is enough. 1923
'use client';
import { createContext, useContext, useState } from 'react';
const Drawer = createContext(null);
export function CartTools() {
const drawerState = useState(false);
return (
<Drawer.Provider value={drawerState}>
<CartButton />
<CartPanel />
</Drawer.Provider>
);
}
function CartButton() {
const [, setOpen] = useContext(Drawer);
return <button onClick={()=> setOpen(true)}>查看购物车</button>;
}
function CartPanel() {
const [open, setOpen] = useContext(Drawer);
return open && <button onClick={()=> setOpen(false)}>关闭购物车</button>;
}
Dmitry Sky suggests Context is enough for rarely changing values read by many components, such as themes. When update rules become complex, Redux centralizes state and rules so changes are easier to trace. When a page has many independently changing values, Jotai can split them into atoms so each component subscribes only to what it uses. 24
The example above shares only the panel toggle, so I'd use Context. What if the header also shows the cart count while the customer edits a delivery note in the panel?
| Approach | How does the header read the count? | What if only the note changes? |
|---|---|---|
| React Context | Read count from the shared cart Context. | The Provider passes a new object containing the new note, so the header also rerenders. A separate Context for the count avoids this notification. 23 |
| Redux + React Redux | Use a selector (a function extracting a value from state) for the count. | React Redux checks the selected count. If it's still two, this update does not trigger header rendering. 25 |
| Jotai | Read only the count atom (an independently subscribable state unit), storing the note in another atom. | Editing the note writes only its atom, which the header does not subscribe to. 26 |
How do Redux, Zustand and Jotai designs affect the choice?
All three can meet this shop's needs. My first comparison is which makes the same feature easier to write and change. The Redux header selects only the count, and Zustand can do the same. All these approaches can skip header rendering. How many subscribers an update notifies and how often values are recomputed depend on data partitioning and component subscriptions. If the editor has a clear response-time target or input feels sluggish, I'd time the same operations before deciding whether performance changes the choice. 21
I think of engineering selection as a funnel:
design principles->implementation->scope of application
Suppose “add one” gains requirements. If customers can undo it, I need to verify each operation separately. If support opens two orders at once, I need to discard just one draft. If selecting a product changes count and total, I want to edit the line once and have both recompute correctly. These are costs worth including in the comparison.
Redux: say what happened, then decide how state changes
Design. Redux concentrates application state in one tree. Actions describe events, and pure reducers compute new state from previous state and an action. “Add one” might need to record undo history as well as changing a count. Having the button dispatch one action puts both rules together. 27
Implementation. Redux Toolkit's createSlice generates action creators and a reducer for a set of rules. Here we edit only one product. Opening the editor dispatches begin(2) so the draft starts from the server-confirmed count of two.
import { createSlice } from '@reduxjs/toolkit';
export const draft = createSlice({
name: 'cartDraft',
initialState: { count: 0, history: [] },
reducers: {
begin: (_, action) => ({ count: action.payload, history: [] }),
addOne(state) {
state.history.push(state.count);
state.count += 1;
},
undo(state) {
if (state.history.length) state.count = state.history.pop();
},
},
});
Register draft.reducer as cartDraft, and the editor subscribes with useSelector(s => s.cartDraft.count). Immer turns draft mutations into new state. React Redux compares selected values with === by default. A note-only change leaves the count identical, so that store update alone does not rerender the count component. 2825
Where it fits. I'd choose Redux when bulk edits, undo and canceled submissions need a set of business rules. Pass begin(2) → addOne() → undo() to the same reducer to verify 2 → 3 → 2 and empty history without opening the page. These actions and rules offer little for a single dialog toggle. In App Router each server request should create its own store. The browser uses the same initial values for its own store, shared with components that need the draft. 7
Zustand: put state and the methods that change it in one store
Design. Zustand gives a store a small interface: call methods to change values and subscribe to see updates. Create stores independently of React and subscribe only to the fields a component needs. The application decides who shares state by choosing where to create and pass each instance. 2921
Implementation. Suppose support opens two orders. The left starts at two, the right at seven. Adding one on the left should give three and seven. The following creates a store per CartEditor, defining quantity, note and two mutation methods.
'use client';
import { useState } from 'react';
import { createStore, useStore } from 'zustand';
export function CartEditor({ initialCount }) {
const [store] = useState(() => createStore(set => ({
count: initialCount,
note: '',
addOne: () => set(s => ({ count: s.count + 1 })),
setNote: note => set({ note }),
})));
return <><CountButton store={store} /><NoteInput store={store} /></>;
}
function CountButton({ store }) {
const count= useStore(store, s=> s.count);
const addOne= useStore(store, s=> s.addOne);
return <button onClick={addOne}>数量 {count},加一件</button>;
}
function NoteInput({ store }) {
const note = useStore(store, s => s.note);
const setNote = useStore(store, s => s.setNote);
return <input aria-label="备注" value={note}
onChange={event=> setNote(event.target.value)} />;
}
Two children in a panel receive the same store. In Zustand 4.5.5 a write first notifies that store's listeners, then the React binding checks selector results. Typing a note changes neither count nor addOne selected by the quantity button. The right-hand panel's store receives no write at all. 21
Where it fits. I'd consider a local store when toolbar, detail table and note box edit one order, and closing the panel should discard its draft. Cleanup follows the component lifecycle. When switching orders in the same position, key={orderId} can give the new order a fresh instance. One or two controls are simpler with local useState. If a workspace already uses Redux to keep drafts across pages by order ID, I'd retain that design. A count selector lets the button skip a rerender for this note update. 19725
Jotai: store inputs and define computed results as dependent atoms
Design. Jotai starts with small state units (atoms) and composes them. Product lines are inputs, selected products are filtered from the lines, and count and total derive from the selection. With dependencies defined this way, selecting, deselecting or changing a quantity needs only a product-line update. 26
Implementation. Reading a derived atom records a dependency on every get. Here both countAtom and totalAtom read selectedAtom, which reads linesAtom. Each line's selected says whether it is checked, quantity is its count, and priceCents is its unit price in cents. 3026
'use client';
import { atom, useAtomValue, Provider } from 'jotai';
import { useHydrateAtoms } from 'jotai/utils';
const linesAtom = atom([]);
const selectedAtom = atom(get => get(linesAtom).filter(line => line.selected));
const countAtom = atom(get =>
get(selectedAtom).reduce((sum, line) => sum + line.quantity, 0));
const totalAtom = atom(get =>
get(selectedAtom).reduce((sum, line) => sum + line.quantity * line.priceCents, 0));
function Summary({ initialLines }) {
useHydrateAtoms([[linesAtom, initialLines]]);
const count = useAtomValue(countAtom);
const cents = useAtomValue(totalAtom);
return <span>已选 {count} 件,共 {(cents / 100).toFixed(2)} 元</span>;
}
export function Checkout({ initialLines }) {
return <Provider><Summary initialLines={initialLines} /></Provider>;
}
Dependencies affect how much work an update does. Add a separate noteAtom, count calls in totalAtom's sum function and use store.sub(totalAtom, listener) to count notifications. In Jotai 2.11.0, subscribe, reset the counters, and place two selected items priced at 1.50 yuan each in the cart. The results are below. 2631
| Operation | Total recalculations | Total subscriber notifications | Why |
|---|---|---|---|
| Write only the independent note atom | 0 | 0 | The total never reads the note. |
| Change a product name in the lines array | 1 | 0 | The new array triggers filtering and summation, but the result remains 3.00 yuan. |
| Change selected quantity from two to three | 1 | 1 | The total becomes 4.50 yuan, so its readers need an update. |
Where it fits. I'd choose Jotai when product lines, checkout button and header share multiple layers of derived values. Each formula is written once, and an independent note change skips the whole total calculation. The table's second row shows the limit. With all products in one array atom, a rename can still resummate the whole table even when no total subscriber is ultimately notified. Existing memoized Redux selectors (reusing results when inputs are unchanged) can also reuse these calculations. Migrating just for a simple addition offers little benefit. 3125
These models explain state changes inside the browser. When the server sends fresh data, the application must decide who receives it. Jotai values live in the current Provider's store, for example. useHydrateAtoms initializes a given atom in that store only once by default. A subsequent server cart still requires an explicit refresh rule. 22
Which components can skip a render?
Summary above reads count and total in the same component. If the merchant changes only the unit price of a selected product, the total changes but the count doesn't. The total subscription still makes React call the entire Summary function again, so the count JSX also executes. If count and total appear in different places, let the header's CartCount read only countAtom and the checkout button only totalAtom. Then this atom update alone won't rerender the header on a price change. Redux and Zustand can do the same with a count-only selector. If the parent rerenders too, a child can run again through that path. 312521
The table counts sum function executions and store notifications. To answer “how many components skipped a render?”, count calls to component functions. For “how much faster was the interaction?”, measure time. React can reuse existing DOM if the displayed text stays the same after a component runs. In my rename experiment, 100 command-only buttons shared a Context containing a username. Every rename executed all 100 buttons. Splitting commands and values into two Contexts and keeping children stable reduced button calls from 100 to zero. Components displaying the new name still needed an update. Rename experiment and measurement conditions.
Even when all 100 labels have to update, component calls tell only half the story. In a later rename experiment, 100 Jotai labels read the same name. When a script clicked repeatedly immediately after mount, the tenth click produced 1,000 atom reads across 100 labels. Let React finish the check queued on subscription before running the same clicks and the tenth click produced only 100 reads. In both cases each label ran just once per click. The difference was how many queued updates React recomputed within one component execution. Source and single-line comparison.
What about someone clicking one at a time? I had the browser press and release the mouse sequentially at intervals of roughly 0.2 to 0.4 seconds, letting React schedule updates itself. I measured 60 clicks per implementation with the same 100 labels. From button click to reading the new name from the DOM, Jotai primitive atoms and Zustand both had a median of 0.60 milliseconds. Counting separately across five clicks, each Jotai label read the name once every time. The growing read count above had specific conditions. If click feedback matters, use these results. For matching the initial render, still check the snapshots both ends use. Individual mouse-click experiment and data.
In the same clicks, React Redux 8.1.3 had a slightly higher median. A separate comparison kept the Redux store, reducer and Provider identical but subscribed using the business selector directly, bypassing the function wrapper added by that version of useSelector. The median fell from 0.90 to 0.70 milliseconds. In separate counts both versions made 100 business selector and 100 component calls per click. The difference more likely reflects the extra work each component did to read its value. Timing the whole click cannot attribute the cost to individual steps. React Redux source and controlled comparison.
Use a query cache when the server owns the cart and several components read, write and refresh it
For this shop, already using Redux and needing the header and panel to update after an addition, I'd choose RTK Query. Both display the same cart record on the server. The browser needs to reuse a read and update interested readers after a successful write. Assume the shop already has APIs to read a cart and add an item, and the server validates cartId against the signed-in identity. 32
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
export const cartApi = createApi({
baseQuery: fetchBaseQuery({ baseUrl: '/api/' }),
tagTypes: ['Cart'],
endpoints: build => ({
cart: build.query({
query: cartId => `carts/${cartId}`,
providesTags: (_, __, cartId) => [{ type: 'Cart', id: cartId }],
}),
addItem: build.mutation({
query: ({ cartId, productId }) => ({
url: `carts/${cartId}/items`, method: 'POST', body: { productId },
}),
invalidatesTags: (_, error, { cartId }) =>
error ? [] : [{ type: 'Cart', id: cartId }],
}),
}),
});
After registering cartApi.reducer and cartApi.middleware, header and panel both call cartApi.useCartQuery(cartId). RTK Query combines endpoint name and arguments into a cache key, so both reads share one result. The add button invokes the submission function returned by cartApi.useAddItemMutation(). After success, invalidatesTags marks that cart stale and refetches when subscribers are present. Clear personal caches on account changes. For a new project needing only remote data caching with no other reason to use Redux, I'd choose TanStack Query directly. Have both use ['cart', cartId] and call queryClient.invalidateQueries({ queryKey: ['cart', cartId] }) after a successful write. Both libraries manage a browser copy of server data. Next.js still manages the public product page's ISR cache. 321016
If the personal cart must appear on first paint, read the customer's cart on the server. Initial HTML and browser takeover use the same value. Once the query resolves, the header and panel switch to the same cached entry. For example, both can read currentData ?? initialCart, with currentData from the current cartId query and initialCart belonging to the same cart. For “add one immediately,” also use the optimistic rules above: one submission at a time, cancel old queries that could overwrite it, roll back failures and reconfirm at completion. Invalidating tags alone triggers a refetch. It cannot make three appear before the server responds. 33217
What would I ultimately choose for this shop?
I'd leave product descriptions in RSC and use RTK Query for the cart and submitted reviews. The header, panel, list and average score read their corresponding cache entries. Use useState for the review input and Context to open the cart across components. An addition then updates server data in one place and both browser readers see the same result. If bulk editing and undo become requirements later, add a Redux slice for unsubmitted drafts.
Looking back at Excalidraw's useAtom(shareDialogStateAtom), I see why Jotai suits that dialog. In the shop I'd consider Jotai for dependencies when several components share derived counts, amounts and similar values. I'd consider Zustand to keep a draft in each panel when support edits several orders and closing a panel should discard its draft. As long as the question is how two places can show the same server-confirmed count after an addition, my choice is RTK Query on the existing Redux setup. 132
Postscript (added December 4, 2025)
The React team subsequently disclosed RSC-related vulnerability CVE-2025-55182 on December 3, 2025. It concerned the server decoding requests to Server Functions and affected some frameworks supporting RSC. That came after my April reading. It concerns security at a cross-environment communication boundary. One user's cart being shown to another or an old response overwriting new state still depend on request isolation and update rules, respectively. 33
Footnotes
-
Excalidraw contributors. (2025, April). Excalidraw app (c79e892e). GitHub. 引入并导出 Jotai Hook;分享弹窗的调用。画板背景见同日的选型记录。 ↩ ↩2
-
Next.js team. (n.d.). Client Components; Composition Patterns (version 14). Next.js Docs. 首次加载与后续导航;在组件树中下移客户端边界。 ↩ ↩2 ↩3 ↩4
-
Herrington, J. (n.d.). Pass Data from the Server to the Client Context. ProNextJS. Checking Our Work,视频 00:59–01:51,引文在 01:36。 ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
Herrington, J. (n.d.). State Management with Next.js App Router. ProNextJS. 四套实现与课程目录。 ↩
-
Herrington, J. (n.d.). Summarizing State Management Options in Next.js App Router. ProNextJS. Hooks、查询库与状态管理模型。 ↩ ↩2
-
Herrington, J. (n.d.). Intro to State Management with Next.JS App Router. ProNextJS. Rule #1,视频 00:34–01:08;Rule #2、#3,01:08–02:15。 ↩ ↩2 ↩3
-
Redux maintainers. (n.d.). Redux Toolkit Setup with Next.js. Redux. The App Router Architecture and Redux。 ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
React contributors. (n.d.). hydrateRoot. React. Caveats 与 Hydrating server-rendered HTML。 ↩ ↩2 ↩3
-
Herrington, J. (n.d.). Integrating User Reviews and Ratings into a Product Detail Page. ProNextJS. 提交后更新评论与平均分。 ↩ ↩2
-
TanStack Query contributors. (n.d.). Advanced Server Rendering (v5). TanStack Docs. Data ownership and revalidation。 ↩ ↩2 ↩3 ↩4
-
Brehm, S. (2013, November 11). Isomorphic JavaScript: The future of web apps. Airbnb Engineering. 两端共用应用代码。 ↩
-
Next.js team. (2021, October 26). Next.js 12. Next.js Blog. React Server Components 与页面级取数。Next.js team. (2022, October 25). Next.js 13. Next.js Blog. app 目录与 Server Components。 ↩ ↩2
-
Next.js team. (n.d.). Lazy Loading (version 14). Next.js Docs. 按需加载客户端组件。 ↩
-
React team. (2020, December). RFC: React Server Components. React RFCs, GitHub. Credits and Prior Art;Is this specific to Next.js?,首段。Abramov, D., Tan, L., Savona, J., & Markbåge, S. (2020, December 21). Introducing Zero-Bundle-Size React Server Components. React. 研究公告。 ↩
-
Next.js team. (2020, July 27). Next.js 9.5. Next.js Blog. Stable Incremental Static Regeneration。 ↩
-
Next.js team. (n.d.). Caching in Next.js (version 14). Next.js Docs. Full Route Cache 与动态渲染。 ↩ ↩2 ↩3
-
TanStack Query contributors. (n.d.). Optimistic Updates (v5). TanStack Docs. 取消旧查询、保存旧值与失败回滚。 ↩ ↩2 ↩3
-
Next.js team. (n.d.). useRouter (version 14). Next.js Docs. router.refresh() 的合并语义与缓存限制。 ↩ ↩2 ↩3
-
React contributors. (n.d.). useState. React. initialState 在首次渲染后的语义。 ↩ ↩2 ↩3
-
React contributors. (n.d.). useSyncExternalStore. React. Adding support for server rendering。 ↩
-
Zustand contributors. (n.d.). Vanilla store and React binding (v4.5.5). GitHub. 写入和监听者;订阅、初始快照与 selector。 ↩ ↩2 ↩3 ↩4 ↩5
-
Jotai contributors. (n.d.). SSR. Jotai Docs. useHydrateAtoms 的初始化语义。 ↩ ↩2
-
React contributors. (n.d.). useContext. React. Caveats:Provider 的值如何比较。 ↩ ↩2
-
Sky, D. (2024, January 23). React Context vs Redux vs Jotai. Medium. 三种模型的概览,见 Summary。 ↩
-
React Redux contributors. (n.d.). Hooks. React Redux. Equality Comparisons and Updates;9.2.0 的 useSelector 实现。 ↩ ↩2 ↩3 ↩4 ↩5
-
Jotai contributors. (n.d.). Store; Atom. Jotai Docs. get、set、sub;读取派生 atom 时的依赖追踪。该例的订阅行为用 Jotai 2.11.0 核对。 ↩ ↩2 ↩3 ↩4
-
Redux maintainers. (n.d.). Three Principles. Redux. Single source of truth、State is read-only、Changes are made with pure functions。 ↩
-
Redux Toolkit maintainers. (n.d.). Writing Reducers with Immer. Redux Toolkit. createSlice 怎样处理草稿更新。 ↩
-
Zustand contributors. (n.d.). Zustand README (v4.5.5). GitHub. Using zustand without React。 ↩
-
Herrington, J. (n.d.). Implementing Jotai for State Management. ProNextJS. 同一应用的 atom 实现。 ↩
-
Jotai contributors. (n.d.). Performance. Jotai Docs. Small components 与 Render on demand。表中次数来自 2026-11-23 对 Jotai 2.11.0 的示例核对。 ↩ ↩2 ↩3
-
Redux Toolkit maintainers. (n.d.). Cache Behavior; Automated Re-fetching. Redux Toolkit. 查询键与共享订阅;缓存标签失效后何时重取。 ↩ ↩2 ↩3 ↩4
-
React team. (2025, December 3). Critical Security Vulnerability in React Server Components. React. 漏洞公告。 ↩