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

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