惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Spread Privacy
Spread Privacy
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
DataBreaches.Net
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
L
LangChain Blog
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
T
Threatpost
V
V2EX
Security Archives - TechRepublic
Security Archives - TechRepublic
GbyAI
GbyAI
Scott Helme
Scott Helme
Cyberwarzone
Cyberwarzone
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
T
Tenable Blog
S
Schneier on Security
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
F
Full Disclosure
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Security @ Cisco Blogs
A
Arctic Wolf
S
Securelist
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tor Project blog
The Register - Security
The Register - Security
L
LINUX DO - 最新话题
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
L
LINUX DO - 热门话题
TaoSecurity Blog
TaoSecurity Blog
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
C
CERT Recently Published Vulnerability Notes

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support How manual QA uses PR testing between releases
React’s useTransition: The hook you’re probably using wrong
Miguel Calderón · 2026-02-10 · via Inside Nutrient

TL;DR

  • useTransition causes two renders: one immediate (isPending = true), and one deferred
  • Use it for expensive CPU-bound state updates, not network requests
  • Keep input state outside the transition; only wrap derived/filtered state
  • Choose useDeferredValue when you don’t control the state setter

Your search input feels laggy. Users type, the user interface (UI) freezes for a moment, and then results appear. You’ve probably tried debouncing, but the user experience still isn’t quite right. Sound familiar? Did you know that React has a built-in solution?

The useTransition(opens in a new tab) hook has been available since React 18 but is still widely misunderstood. This article will look at how it actually works under the hood, outline when you should (and shouldn’t) use it, and walk through real examples from a production PDF viewer codebase.

What useTransition actually does

Before checking some usage patterns, it’s important to first understand what’s happening behind the scenes. When you call useTransition, you get back two things:

const [isPending, startTransition] = useTransition();

The isPending Boolean tells you if there’s a transition in progress, and startTransition is a function to wrap your state updates. But here’s what’s usually ignored: useTransition causes a double rerender.

This becomes clear when you consider the required behavior for isPending: It needs to be true during the transition, allowing the UI to render a transition state, and false afterward to indicate the transition has completed.

The first is an immediate, high-priority render where isPending becomes true. The callback is then scheduled at a lower priority, and when it completes, a second render occurs with isPending set to false. This means React can interrupt this work if something more urgent comes along (like the user typing another character).

Lane scheduling: How React prioritizes

React 18 introduced a concept called “lanes” for scheduling updates. When you wrap state updates in startTransition, React assigns your updates to a lower-priority lane. This is what makes transitions interruptible — higher-priority updates (like direct user input) can jump the queue.

The classic use case: Search input

The most common scenario for useTransition is search-as-you-type functionality. Here’s a typical problematic implementation:

function SearchDocuments({ documents }) {

const [query, setQuery] = useState('');

const [results, setResults] = useState(documents);

const handleSearch = (value) => {

setQuery(value);

// Expensive filtering blocking the input.

setResults(documents.filter(doc =>

doc.content.toLowerCase().includes(value.toLowerCase())

));

};

return (

<div>

<input

value={query}

onChange={e => handleSearch(e.target.value)}

/>

<ResultsList results={results} />

</div>

);

}

When filtering thousands of documents, every keystroke triggers an expensive operation that blocks the main thread. The input feels sluggish because React can’t update the input value until the filtering completes.

Here’s the same component with useTransition:

function SearchDocuments({ documents }) {

const [query, setQuery] = useState('');

const [results, setResults] = useState(documents);

const [isPending, startTransition] = useTransition();

const handleSearch = (value) => {

setQuery(value); // Immediate — keeps input responsive.

startTransition(() => {

// Expensive filtering — can be interrupted.

setResults(documents.filter(doc =>

doc.content.toLowerCase().includes(value.toLowerCase())

));

});

};

return (

<div>

<input

value={query}

onChange={e => handleSearch(e.target.value)}

/>

{isPending && <LoadingSpinner />}

<ResultsList

results={results}

style={{ opacity: isPending ? 0.7 : 1 }}

/>

</div>

);

}

The key insight: setQuery(value) happens immediately (high priority), while setResults() is wrapped in a transition (low priority). If the user types another character before filtering completes, React abandons the in-progress transition and starts a new one with the updated query.

useTransition vs. useDeferredValue: When to use which

React 18 also introduced useDeferredValue(opens in a new tab), which can seem similar. Here’s how to choose.

Use useTransition when:

  • You control the state update (you have access to the setter)
  • You need the isPending flag to show the loading UI
  • You want to wrap multiple related state updates together

Use useDeferredValue when:

  • The value comes from props or external state you don’t control
  • You just need a “stale” version of a value that updates later
  • You’re optimizing a child component without modifying the parent

Here’s useDeferredValue in action:

function ResultsList({ results }) {

// Create a deferred copy that lags behind during transitions.

const deferredResults = useDeferredValue(results);

const isStale = results !== deferredResults;

return (

<div style={{ opacity: isStale ? 0.7 : 1 }}>

{deferredResults.map(result => (

<ResultItem key={result.id} result={result} />

))}

</div>

);

}

The child component doesn’t need to know about transitions — it just gets props and creates a deferred version. This is great for optimizing existing components without refactoring parents.

useTransition vs. debouncing

You might wonder: Why not just debounce the search? The following table shows how useTransition and debouncing compare.

AspectDebouncinguseTransition
DelayFixed (e.g. 300ms)Dynamic (React decides)
Input feelPotentially laggyAlways instant
Loading stateMust manage yourselfBuilt-in isPending
CancellationManual cleanup neededAutomatic

Debouncing adds an artificial delay before any work starts. useTransition starts work immediately but allows it to be interrupted. The practical difference is that with debouncing, users wait for a predetermined amount of time before anything happens. With useTransition, work begins immediately but the input stays responsive.

That said, debouncing is still the right choice when you’re making network requests — useTransition is for CPU-bound work, not I/O.

At Nutrient, our Web Viewer SDK needs to search through potentially thousands of pages of text. Here’s a simplified version of how we handle search:

// Before: Every keystroke dispatches immediately.

const handleSearchQueryChange = (value) => {

dispatch(searchForTerm(value)); // Expensive operation

};

// After: Wrap expensive dispatch in transition.

const [isPending, startTransition] = useTransition();

const handleSearchQueryChange = (value) => {

startTransition(() => {

dispatch(searchForTerm(value));

});

};

The search input stays responsive even when searching through a 500-page document.

When NOT to use useTransition

useTransition isn’t a silver bullet. Avoid it in the following scenarios.

1. Network requests

useTransition doesn’t wait for promises. If you wrap a fetch call, the transition completes immediately while the request is still in flight:

// This doesn't work as expected.

startTransition(() => {

fetchResults(query).then(setResults); // Transition ends before data arrives.

});

For async operations, use React Suspense with data fetching libraries, or manage loading state separately.

2. Already fast operations

If your state update takes less than 16ms (one frame), the overhead of transitions isn’t worth it. Measure first with React DevTools Profiler.

3. Critical UI feedback

Don’t wrap state updates that users need to see immediately:

// Don't do this — form validation should be instant.

startTransition(() => {

setValidationError('Email is required');

});

Advanced pattern: Transition with context

In larger applications, a coordination problem may arise when global state changes trigger expensive rerenders across multiple components and you need a way to manage transitions at the source rather than in every consumer.

In these advanced use cases, Context may be required to update and propagate to all consumers simultaneously, which may prove challenging. If your filter state affects — for example — a sidebar, a results list, and a summary panel, a single setFilters() call triggers rerenders in all three. Without coordination, each component would need its own useTransition — leading to duplicated logic and inconsistent loading states.

By placing useTransition in the Context provider, you centralize the transition logic and expose isPending alongside the state:

function FilterProvider({ children }) {

const [filters, setFilters] = useState(defaultFilters);

const [isPending, startTransition] = useTransition();

const updateFilters = (newFilters) => {

startTransition(() => {

setFilters(newFilters);

});

};

return (

<FilterContext.Provider value={{ filters, updateFilters, isPending }}>

{children}

</FilterContext.Provider>

);

}

All consumers of the context can now show loading states based on isPending without implementing transitions themselves. The sidebar can dim its content, the results list can show a spinner, and the summary panel can display a skeleton — all reacting to the same isPending flag from a single source of truth.

Debugging tips

When transitions don’t behave as expected, two approaches help: inspecting render priority in DevTools, and logging to detect interrupted work.

React DevTools profiler

In React DevTools, transitions show up with a special “Transition” label. You can see which renders were high priority vs. transition priority.

Console logging

Add logs inside your transition callback to see when work starts and if it gets interrupted:

startTransition(() => {

console.log('Transition starting for:', value);

setResults(expensiveFilter(value));

console.log('Transition completed for:', value);

});

If a transition gets interrupted, you’ll see “starting” without a corresponding “completed.”

Key takeaways

  1. useTransition causes two renders — one immediate (isPending = true), and one deferred (isPending = false + your updates)
  2. Use it for expensive CPU-bound state updates, not network requests
  3. The input state should NOT be wrapped — only the expensive derived state
  4. Choose useDeferredValue when you don’t control the state setter or want to optimize a child component
  5. Measure before optimizing — transitions add overhead, so only use them when you have a measurable jank problem

React’s concurrent features give you control over update priority. Instead of all-or-nothing renders, you can now keep input responsive while expensive work happens in the background. When your UI feels sluggish during state updates, useTransition is worth considering — and now you know exactly what’s happening under the hood.