Answer the question
In order to leave comments, you need to log in
What do you think about the idea of committing pageYOffset to a state?
For example, I need a value pageYOffset
in several components. The idea came up instead of hanging a handler on the scroll on each component, just store this value in the store and take values from there. What are the consequences? Is it cheaper than doing the same thing in 5 different places?
Answer the question
In order to leave comments, you need to log in
It is unlikely to achieve a performance gain. But in terms of code cleanliness, this is a completely normal solution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question