reactjs / reactjs/react.dev

[Suggestion]: Correction of misleading explanation in react.dev/learn (Quick Start)

Offen
#8,247 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

type: documentation
Vorherrschende Sprache
JavaScript
Sterne
11.8k
Forks
7.9k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
11

Beschreibung

Summary

Image

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

https://react.dev/learn

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne auf der verlinkten react.dev/learn-Seite und finde die hervorgehobene Erklärung in Quick Start. Überprüfe die umgebende JSX- und JavaScript-Formulierung und stelle dann den Unterschied zwischen Ausdrücken innerhalb geschweifter Klammern und direkten if-Anweisungen klar; die Seite sollte korrekt erklären, warum das Beispiel so geschrieben ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.