reactjs / reactjs/react.dev

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

Aberta
#8,247 4 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

type: documentation
Linguagem predominante
JavaScript
Estrelas
11.8k
Forks
7.9k
Merge médio
1d 11h
PRs com merge (30d)
11

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pela página react.dev/learn vinculada e localize a explicação destacada em Quick Start. Revise a redação ao redor sobre JSX e JavaScript e, em seguida, esclareça a distinção entre expressões dentro de chaves e instruções if diretas; a página deve explicar com precisão por que o exemplo está escrito dessa forma.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, react
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
50/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.