In the same component yes, cause you’re negating the benefits of the observer by firing scroll events.

If performance is not an issue, go with whatever works though. Observers are only here as a performance enhancement. If you don’t have a perf issue, you don’t *necessarily* need to use them at all :)

--

--

--

Front-end ReactJS Developer — https://aggelos.dev

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aggelos Arvanitakis

Aggelos Arvanitakis

Front-end ReactJS Developer — https://aggelos.dev

More from Medium

Puff The Magic Dragon Meant What?

I am new to Medium, but I like what I see so far.

Christmas spirit and new beginnings

Field Trip to Cambridge