Transition priority

전환 우선순위

Urgent input and slower screen updates receive different priorities.

···
html
<div class="scene"><b>UPDATE PRIORITY</b><div class="lane"><span>input</span><div class="rail"><i id="urgent"></i></div></div><div class="lane"><span>results</span><div class="rail"><i id="slow"></i></div></div><div class="label" id="note">urgent update runs first</div></div>
css
.scene{width:min(94vw,800px);height:min(86vh,320px);position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;border:1px solid var(--line);border-radius:14px;background:var(--surface);padding:clamp(9px,2.4vmin,20px);font:500 clamp(15px,4vmin,18px)/1.3 var(--font-sans,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif)}.scene b,.scene strong{font-weight:700}.label{color:var(--muted)}.code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.pill{border:1px solid var(--line);border-radius:8px;padding:.4em .65em;background:var(--bg)}.active{border-color:var(--accent)!important;color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 10%,var(--surface))!important}.scene>b{color:var(--accent)}.lane{display:flex;align-items:center;gap:10px;margin:clamp(16px,7vmin,45px) 0}.lane span{width:25%}.rail{height:clamp(18px,5vmin,30px);flex:1;border-radius:20px;background:var(--bg);border:1px solid var(--line);position:relative}.rail i{position:absolute;top:2px;bottom:2px;left:2px;width:18%;border-radius:20px;background:var(--accent);transition:left .5s}.lane:nth-of-type(2) i{background:var(--accent-3)}.label{text-align:center}
js
let n=0;function tick(){const step=n%5;document.getElementById("urgent").style.left=(step*19)+"%";document.getElementById("slow").style.left=(Math.max(0,step-2)*19)+"%";document.getElementById("note").textContent=step<3?"input stays responsive":"results catch up";n++}tick();setInterval(tick,650)

A state update marked with startTransition can yield to urgent work such as typing. React may interrupt a transition render and restart with fresher work.

The demo places input and result rendering on separate lanes: input advances first, then the list follows. A transition does not make the network request itself faster.

When to use

Use it to keep typing responsive while a large result list updates.

Open as page ↗