Skip to content
Discussion options

You must be logged in to vote

The lib only stores one state. But you can use the from option.

So you could do something like:

const bind = useDrag(({ offset }) => {
// logic with offset
}, { from: ({ args: [index] }) => [springs[index].x.get(), springs[index].y.get()] }
  
return <>
  { springs.map((style, index) => (<div ref={index} {...bind(index)} />)
</>

This is just pseudo code but do you get the idea?

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ghost
Comment options

@ghost
Comment options

@dbismut
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant