[Suggestion]: Tic-tac-toe tutorial should explicitly explain that mutation causes unreliable re-rendering
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- JavaScript
- Estrelas
- 11.8k
- Forks
- 7.9k
- Merge médio
- 1d 11h
- PRs com merge (30d)
- 11
Descrição
Summary
The tutorial's Why immutability is important section doesn't clearly state that mutating state causes unreliable re-rendering behavior.
Page
https://react.dev/learn/tutorial-tic-tac-toe#why-immutability-is-important
Details
While following the tic-tac-toe tutorial, I was confused about why .slice() is necessary. The "Why immutability is important" section talks about time travel features and performance optimizations, but it never explains that mutating the array directly will cause React to not reliably detect the change, meaning the component may not re-render.
It seems as though that is the primary reason the tutorial uses .slice(), but it's not mentioned. I only found this explanation later in the "Updating Objects in State" article. It would be helpful to include this explanation in the tutorial where beginners first encounter the pattern.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Abra o tutorial de Tic-tac-toe vinculado na seção “Why immutability is important” e compare-o com o artigo referenciado “Updating Objects in State”. Atualize o tutorial para explicar que a mutação direta pode impedir que o React detecte alterações de forma confiável e renderize novamente; em seguida, verifique se a explicação se encaixa na discussão existente sobre slice(), time travel e performance.
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
- 1/5
- Tempo estimado
- Menos de uma hora
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 52/100