Skip to main content
← All insights

Engineering / Case study

React hidden DOM

Before
177.5ms
After
23.3ms
What was measured
p95 switch estimates

Local demo · 30 switches per run
Study: 27 September 2026 · Not production results

Explore the interactive rendering lab ↓

React hidden DOM is a mounted document object model (DOM) subtree that remains in memory outside the visible presentation. React hidden DOM remains mounted when Cascading Style Sheets (CSS) hide a responsive alternative. React hidden DOM’s recorded node count exceeds 121,000 across 3,817 hidden mobile cards in my 27 September 2026 navigation study. The study records a 95th-percentile (p95) switch estimate of 177.5 milliseconds (ms) with both presentations and 23.3 ms with the active presentation only. The active presentation retains the customer dataset and workspace context, with 40 cards per mobile page. Each timing run contains 30 serial, prepared switches in an optimized local desktop build on one computer. The local estimates do not establish exact paint timing, physical-phone performance or production results.

How do you measure a prepared React screen switch?

A prepared React screen switch requires a separate timing window after the destination data and screens are ready. The 27 September study separates stage loading and data preparation from repeated screen changes. The recorded switch windows contain no coincident resource entries, while fetching and preparation remain part of the wider experience.

The booking workflow supplies a concrete interaction. Staff move between a calendar and customer records while keeping the selected week, customer search and each screen’s scroll position. The local demo retains both screens and their prepared data to preserve that context.

The study compares five progressively richer stages. First comes fixed test data. Second come lightweight views with real reads. Third come full screens. Fourth come detail panels. Fifth comes background refresh. Lightweight views switch quickly in the recorded comparison, while full screens retain a higher delay.

Prepared navigation trades memory for retained context. Retained context reduces repeated preparation during a screen change. An uncached first visit still requires its own measurement. A calendar-to-customer switch therefore does not measure the cost of opening the application for the first time.

Does CSS hiding remove React DOM nodes?

CSS hiding does not remove mounted DOM nodes or automatically stop component JavaScript work. The display: none value suppresses layout boxes for an element and its descendants. A suppressed layout box does not establish component removal.

MDN Web Docs documents the CSS display property. MDN Web Docs distinguishes box suppression from changes to the document tree. MDN Web Docs’ display reference describes the behavior of display: none and its descendants.

The recorded customer screen supplies a measurable example. A virtualized desktop table shares the mounted page with 3,817 mobile cards hidden by CSS. The hidden list’s node count exceeds 121,000 in the inspection. The recorded node total belongs to the mobile presentation even while the desktop user works with the table.

Filtering the demo to fewer rows also reduces the recorded delay. The reduced delay and the large hidden subtree support testing the responsive presentation. Neither observation proves that every hidden node is painted or assigns a fixed cost to each node.

How do you reduce React DOM without losing screen context?

Shared records connect to a desktop table and a mobile card view, with a choice between the two presentations.
The local study retains records and selects the active viewport presentation. The diagram does not report a production performance result.

React DOM can be reduced by mounting only the active responsive presentation while retaining the dataset and workspace context separately. The recorded demo preserves its virtualized desktop table and uses 40 cards per mobile page. The complete filtered customer dataset remains in memory.

The study log includes an artificial intelligence (AI) agent’s review of the performance hypothesis. The reviewed hypothesis leads to an opt-in demo change rather than a production navigation change. The comparison therefore tests a bounded presentation decision.

The demo uses three complementary patterns.

  1. Preserve customer records outside the responsive presentation.
  2. Retain workspace context across calendar and customer screens.
  3. Mount the active presentation with desktop virtualization or mobile pagination.

Mobile pagination provides a concrete distinction between data and presentation. Forty visible cards occupy a page while the remaining filtered records stay available in memory. Moving to another page changes the mounted cards without discarding the underlying customer dataset.

Both primary screens retain their working context in the demo. Changing the responsive child presentation does not require removing the entire customer workspace. The initial experiment leaves production navigation defaults unchanged.

How much does the smaller React presentation change switch timing?

The 27 September 2026 study records 177.5 ms and 23.3 ms p95 switch estimates for the two full-screen configurations. Each timing run contains 30 serial, prepared switches in an optimized local build in a desktop browser on one computer. The comparison describes a local sample rather than a measured production improvement.

Mac is the computer platform used for the 27 September 2026 local study. Mac hosts the optimized local build on one recorded computer. Mac’s single-computer test environment does not represent performance on other devices.

Chrome is the desktop browser used in the local study. Chrome runs the prepared-switch demo in the recorded setup. Chrome’s recorded test session supplies two-frame estimates rather than exact paint times.

The full-screen demo contains two measured configurations.

Full-screen demo configuration p95 switch estimate
Desktop table plus the CSS-hidden mobile list 177.5 ms
Viewport-specific customer presentation 23.3 ms
Responsive layout before and after with a desktop table plus hidden mobile cards versus the active layout only. Local p95 estimates are 177.5 ms and 23.3 ms.

Explanatory illustration of the optimized local Chrome demo. Each run contains 30 switches. The two-frame estimates are not exact paint timings or production results.

The recorded reduction identifies mounted presentation as a substantial contributor in the demo. The study does not provide an exact central processing unit (CPU) breakdown. The available observations do not separate the contribution of scripting, style calculation, accessibility processing, layout and paint.

The timing method uses animation-frame checkpoints. MDN Web Docs explains that requestAnimationFrame callbacks run before repaint. A callback timestamp therefore does not certify the instant pixels become visible. The estimates are not Core Web Vitals or a physical-phone benchmark.

How do you test hidden React DOM?

A hidden React DOM test needs one defined interaction, a subtree inspection, a bounded presentation change and a repeated measurement. Keeping the data and environment comparable limits changes to the workload. A prepared calendar-to-customer switch supplies one concrete test case.

How do you define a React navigation test?

First, define one route and one action. A prepared calendar-to-customer switch gives the test a visible start and destination.

  1. Record the build mode, browser, viewport, dataset size and cache state.
  2. Measure initial loading and data preparation separately.
  3. Inspect the Network panel for requests that block the action.

A request close to a click does not prove that the interface waits for the response. A blocking request needs evidence from the interaction’s timing and dependencies.

How do you count a React subtree’s elements?

Second, inspect repeated lists, responsive alternatives, closed panels and retained screens in the browser’s Elements panel. The Chrome developer tools selection variable $0 identifies the currently selected element. A read-only JavaScript expression counts descendant elements of the selected container.

$0.querySelectorAll('*').length

The element count excludes the selected container and does not count every DOM node type. For example, selecting the mobile-list container measures the descendant elements of that list rather than the entire page. The count locates a large subtree without establishing a universal safe limit or a per-element performance cost.

The browser’s Performance recording separates a different question. The performance trace helps distinguish JavaScript work from browser rendering work. The subtree count describes size, while the trace describes work over time.

How do you compare React rendering changes fairly?

Third, change one bounded piece of presentation. Removing an inactive mobile variant keeps the comparison focused on duplication.

  1. Remove the inactive responsive variant for the test.
  2. Test pagination or virtualization for a large active list.
  3. Preserve the dataset and interaction across configurations.

React associates state with a component’s position in the render tree. React can discard that state when the component is removed. React’s state-preservation documentation explains the component-lifetime boundary.

Search text, selected records, scroll position and unfinished input each need an explicit owner. For example, removing a customer view can erase an unfinished filter when the filter state lives only inside that view. Preserving the records alone does not preserve every interaction state.

How do you validate a faster React screen switch?

Fourth, repeat the same interaction in the same environment. A 30-switch local sample supplies a starting point rather than a device-wide conclusion.

  1. Repeat the prepared interaction with the same timing method.
  2. Record each preparation stage separately from switching.
  3. Extend repeated runs to representative physical devices.
  4. Check resizing, keyboard focus, hidden-screen accessibility and retained filters.
  5. Check slow or failed background refreshes.

A faster calendar-to-customer switch still fails the workflow when the selected week disappears. Timing and context retention therefore need separate observations.

When should a React screen stay mounted?

A React screen can stay mounted when repeated navigation needs its local working context and the retained presentation cost is acceptable. Retaining a screen also retains application state and presentation. The measured customer workflow separates the useful retained dataset from the unnecessary second responsive presentation.

The calendar’s selected week provides a practical example of context worth preserving. The hidden mobile card tree provides a separate example of presentation to evaluate. Keeping the week does not require mounting a mobile list on a desktop viewport.

Does display none stop React effects?

CSS hiding does not automatically stop component JavaScript work. An effect can continue while its component remains mounted. Component behavior needs a separate inspection from the element’s visual display state.

Does a smaller DOM guarantee faster React navigation?

A smaller DOM does not guarantee faster navigation for every workload. The local study records a reduction for one prepared interaction and environment. Network waits, component work and state management require their own measurements.

Are the 23.3 ms React results production measurements?

The 23.3 ms estimate belongs to the 27 September 2026 local desktop study. The observation uses 30 prepared switches per timing run on one Mac. The study does not establish production gains, physical-phone results or exact paint timing.

Interactive / In your browser

See what stays mounted.

Same sample data, different presentation decisions. Open DevTools → Network to watch the view module load. These are vanilla DOM demonstrations of the mechanisms discussed above, not a React benchmark. Changing a strategy resets the workspace note.

Replay remounts Customers using the selected speed and clears its note. The downloaded module stays cached.

Records in memory0
Mounted elements in stage0
View moduleNot requested
Interaction elapsed includes simulated wait0.00s
  1. 1 · Load module
  2. 2 · Teaching pause
  3. 3 · Mount view

Preparing interactive controls…

    Try this: open Customers, type a note, then switch away and back. Compare keeping the view with unmounting it. Next, mount the hidden presentation and watch the element count rise. Finally, compare pagination with content-visibility: fewer mounted rows and deferred rendering solve different problems.

    Reference: dynamic import · content-visibility

    What this demo does (and does not measure)

    The counters inspect real elements in this stage. The presentation selector is an explicit viewport model, so you can compare both layouts on any device. “Mount, then hide” creates both presentations and sets the inactive one to display: none. Pagination mounts 12 sample records per page; it does not implement scroll virtualization. The content-visibility option keeps all 240 rows in the DOM while allowing supporting browsers to skip offscreen rendering. Compare its unchanged node count with pagination.

    Customers is a separate JavaScript chunk loaded by dynamic import. Prefetch requests that chunk early. A browser can already have cached it; reset clears demo state, not the browser module cache. To repeat a cold request, reload with DevTools cache disabled. Slow-motion mode adds an artificial pause before a newly mounted view; retained views skip that pause. The timer measures elapsed interaction time including the pause, not network time or exact paint. No timings here reproduce the historical 177.5ms / 23.3ms study.