Skip to content

Modified function output followed by Parallax, ParallaxLayer update, useRef #1768

@sampashas

Description

@sampashas

Hello everyone!

I'm not sure if this belongs to the category of questions, because it looks like a bug:

When i want add event scroll to track its position on the page, i used useRef and almost everything worked, except for the smoothness of the scrollToTop event, but that's not about it now. Then I got the value of useRef as an object indicating what kind of object it was and could manipulate it (I needed to get the value of ref.current.container)

I was getting this:
Снимок экрана 2021-11-24 в 15 53 28
console.log(ref)
console.log(ref.current.container)

At that time I used react-spring@8.0.27 with that dependency
import { Parallax, ParallaxLayer } from 'react-spring/renderprops-addons'

But when i needed add sticky container it's not worked
And I had to turn to the example from the react-spring documentation

There I encountered other dependencies
import { Parallax, ParallaxLayer } from '@react-spring/parallax'
With which the sticky container worked, but the opportunity to get the correct ref was broken

I was getting this:
object itself disappeared and became impersonal
Снимок экрана 2021-11-24 в 15 52 54
console.log(ref)
console.log(ref.current.container)

Question:
How do I get the correct ref in this case?

Thank's for any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions