tsuyoshiwada / react-stack-grid

MIT License
178 stars 31 forks source link

useState reorganizing the stack on every render #4

Closed zilahir closed 4 years ago

zilahir commented 4 years ago

Hi!

I have the following code:

const [currY, setCurrY] = React.useState(0)
    useScrollPosition(({ currPos }) => {
        console.debug('currPos', currPos.y)
        setCurrY(currPos.y)
    }, [])

Whenever I scroll, the entire stack is getting reorganized.

From the documentation I wasnt able to figure out why, do you have any idea maybe? :)

Thank you,