Finally.. I used:
componentDidMount() {
window.scrollTo(0, 0)
}
EDIT: React v16.8+
useEffect(() => {
window.scrollTo(0, 0)
}, [])
More Related Contents:
- Parse Error: Adjacent JSX elements must be wrapped in an enclosing tag
- Angular 2 Scroll to bottom (Chat style)
- How do I correctly pass a “cell item” to a .sheet from a SwiftUI LazyVGrid?
- Detect scroll direction in React js
- Scroll into view in react
- Using Tumblr Like Button with Infinite Scroll
- How to Call a Function inside a Render in React/Jsx
- scrollintoview animation
- How to check if element is visible after scrolling?
- React setState not Updating Immediately
- When to use functional setState
- Applying className/onClick/onChange not working on Custom React Component
- Warning: Text content did not match. Server: “I’m out” Client: “I’m in” div
- How do I restrict the type of React Children in TypeScript, using the newly added support in TypeScript 2.3?
- How to loop and render elements in React.js without an array of objects to map?
- ReactJS: Warning: setState(…): Cannot update during an existing state transition
- Do I have to store tokens in cookies or localstorage or session?
- When should I use brackets with imports
- Detect if a page has a vertical scrollbar?
- Use custom build output folder when using create-react-app
- Uncaught Error: Invariant Violation: findComponentRoot(…, …$110): Unable to find element. This probably means the DOM was unexpectedly mutated
- I am getting error in console “You need to enable JavaScript to run this app.” reactjs
- Error: How to serialize data from getStaticProps : Next.js
- Uncaught TypeError: fs.readFileSync is not a function
- What is the difference between componentWillMount and componentDidMount in ReactJS?
- Use Object.assign or Spread Operator in React/Redux? Which is a better practise
- Read the current full URL with React?
- How to use images in css with Webpack
- React’s setState method with prevState argument
- Next Image not taking class properties