[feat]: Add example with dynamic transitions to `useTransition` documentation

Aperta
#1,850 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript

Direzione di ricerca

Inizia dalla pagina della documentazione di useTransition e dal CodeSandbox collegato per comprendere l’esempio di transizione dinamica proposto. Il lavoro è completo quando viene aggiunta una sezione interattiva che spiega le opzioni delle funzioni per from, enter e leave, e dimostra transizioni guidate dallo stato dell’applicazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind: request
A clear and concise description of what the feature is

I'm considering submitting a PR (wondering if it would be welcome before I put the work in) to add an example to the useTransition documentation that would answer this Stack Overflow question.

It's my question and I seem to have (mostly) solved it myself by tinkering with the example in the docs. Here is my updated Sandbox

Why should this feature be included?

I think including something like this in the main body of the documentation on transitions (not just in the Demos section) could be helpful because:

  1. It uses the function options to the from, enter, and leave props. I had trouble figuring out what those actually were for based on the documentation (ie, what happens when you pass a function arg instead of an object), and really just guessed based on what I thought they might do. Maybe I missed something though.
  2. It's an example where the transition is dynamic based on application state, which I feel is lacking in the current documentation.
  3. I'm not sure if the isAnimating state is a good approach, but maybe we can decide if it is, and give users a place to start if they need to do something similar. I had to do this because if the transition hadn't finished and you clicked a button, it would go to the wrong index.
Please provide an example for how this would work

It could be a new section in the useTransition documentation page that would be interactive.

Lingua principale
TypeScript
Stelle
29.3k
Fork
1.2k
Merge medio
3g 15h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pmndrs/react-spring

Tutte le issue di pmndrs/react-spring

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.