pmndrs / pmndrs/react-spring

[feat]: Better events for SpringValue.

Open
#2,322 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

template: 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
const springV = useSpringValue(0);

springV.onChange((v) => console.log(`val now be ${v}`));

Just like a to function but always request value and return nothing. And same for other events.

Why should this feature be included?

It can help to share a SpringValue to others by pass in props. Now, I can only add listener at useSpringValue.

Please provide an example for how this would work

Im trying to pass a SpringValue called seed (witch computed by mousemove) to Subcomponents, and each Subcomponents owned a SpringValue called ans.

Normally ans should be computed by seed (like using to instead a useSpringValue). But when I drag a Subcomponent, it must return to oraginal status and folow my dragging.

So I can only use .set and .start in to function to set seed value to ans and put return on a fake animad.div.

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 by reading the existing SpringValue and useSpringValue behavior, then compare it with the to, set, and start APIs mentioned in the issue. Define the event surface and expected behavior for onChange and the other events before implementing it. Done means a SpringValue can be passed to subcomponents and observed directly without a wrapper or fake animated element.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.