[Suggestion]: Correction of misleading explanation in react.dev/learn (Quick Start)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
Summary
In the image above, the highlighted text implying that if statements don't work in JSX is misleading. As this is a resource that will be used by a lot of developers looking to learn React, I believe it would be beneficial to the community to clarify the information that was intended to be passed on to readers
Page
Details
As stated earlier in the page—code inside the curly braces is actually JavaScript. In the context of the highlighted text one could be led to believe that using if statements in a JSX file simply won't work or using it inside the curly braces also won't work which are both inaccurate. It is important for someone new to JSX to understand that the code inside the curly braces is supposed to be an expression.
Simply explaining that the js inside the curly braces must be an expression that returns a value, in this case—a markup should help the user better understanding why we shouldn't use an if statement directly in there.
Thank you for your time.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the linked react.dev/learn page and locate the highlighted explanation in Quick Start. Review the surrounding JSX and JavaScript wording, then clarify the distinction between expressions inside curly braces and direct if statements; the page should accurately explain why the example is written as it is.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100