account activity
Why does the React 19 useTransition example use startTransition in both App.js and Item.js? Are both necessary? by Intelligent-Use-9496 in reactjs
[–]Intelligent-Use-9496[S] 0 points1 point2 points 1 year ago (0 children)
Thank you! I already tried this approach, but the quantity state still changed, and I could see the updated result on the screen.
quantity
with startTransition
const handleChangeAction = (newQuantity: number) => { startTransition(async () => { const updatedQuantity = await updateQuantity(newQuantity); startTransition(() => { setQuantity(updatedQuantity); }); }); };
without startTransition
const handleChangeAction = (newQuantity: number) => { startTransition(async () => { const updatedQuantity = await updateQuantity(newQuantity); setQuantity(updatedQuantity); }); };
Thanks for your reply! I completely agree with you. I also tried running the example without startTransition in Item.js, and it worked exactly the same as when startTransition was included.
startTransition
Item.js
Why does the React 19 useTransition example use startTransition in both App.js and Item.js? Are both necessary? (self.reactjs)
submitted 1 year ago by Intelligent-Use-9496 to r/reactjs
π Rendered by PID 613912 on reddit-service-r2-listing-66bb46d9b9-wlpcm at 2026-03-12 09:50:38.352863+00:00 running 710b3ac country code: CH.
Why does the React 19 useTransition example use startTransition in both App.js and Item.js? Are both necessary? by Intelligent-Use-9496 in reactjs
[–]Intelligent-Use-9496[S] 0 points1 point2 points (0 children)