reactjs / reactjs/react.dev

[Suggestion]: Confusing example in UseTransition

Open Beginner friendly
#8,381 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: documentation
Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

Summary

In UseTransition example, you have used input as DOM control so it's instantly updating quantity, which is confusing as it suppose to wait for server call then we can understand the use of transition there, I don't find this document is useful, all examples are very confusing.

below code would be helpful. Didn't expect this from react doc itself, I feel I have better understanding than who written this doc's.

export default function Item({quantity, onUpdateQuantity}) { function handleChange(event) { onUpdateQuantity(event.target.value); } return ( <div className="item"> <span>Eras Tour Tickets</span> <label htmlFor="name">Quantity: </label> <input type="number" value={quantity} onChange={handleChange} /> </div> ) }

Page

No response

Details

Please update Use Transition example that is related to quantity and total.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the linked useTransition documentation example, “Perform non-blocking updates with Actions,” and review how the quantity input and total are presented. Compare the proposed Item example with the current flow, then update the quantity-and-total example so the transition’s purpose is clear around the server call. Done means the revised example is understandable and accurately demonstrates the intended transition behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.