pmndrs / pmndrs/react-spring

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

Open
#1,850 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: request
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the useTransition documentation page and the linked CodeSandbox to understand the proposed dynamic transition example. Done means adding an interactive section that explains function options for from, enter, and leave, and demonstrates transitions driven by application state.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.