[Typo]: Code example mistake in useMemo page
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 1g 11h
- PR unite (30g)
- 11
Descrizione
Summary
There is a mistake in the ChatRoom example code on the useMemo page, specifically in the 'Preventing an Effect from firing too often' section.
Page
https://react.dev/reference/react/useMemo#preventing-an-effect-from-firing-too-often
Details
There are two mistakes in the ChatRoom example under the 'Preventing an Effect from firing too often' section:
- The line
const options = createOptions()suddenly appears in the code without context. It seems like this should be removed. - In the comment 'Only changes when createOptions changes', the reference to 'createOptions' should be replaced with 'options object'. This is because options is the actual dependency in the useEffect.
Screenshot of typo:
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Apri la pagina di riferimento di React useMemo alla sezione “Preventing an Effect from firing too often” ed esamina l’esempio ChatRoom. Conferma la riga createOptions estranea e il commento sulle dipendenze, quindi verifica che l’esempio sia autonomo e che la formulazione descriva accuratamente l’oggetto options.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 65/100