Ok if anyone read this , in my case the problem wasn't any of above. You must try first suggestions on above any way. I did everything including preventDefault()
but didn't help me. The problem was ; using styled-components
. Because, styled-components give a random classname every render. So it resets scroll. I gave the class name from css and solved my problem.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…