score:0
if you're already using react, i would suggest doing your scrolling in a declarative way, instead of manipulating the dom yourself.
check out something like react-scroll.
it allows you to do stuff like:
scroll.scrollmore(100)
just pop that in whatever lifecycle event you want.
score:0
if you want to do window scroll to some specific position then maybe consider use url anchor.
check here how to use url anchor
if you try to have "transition" effect while scrolling, then consider use "transform" instead of scrolling.(this is more suitable for scroll inside an element, not window itself)
Source: stackoverflow.com
Related Query
- Pure Javascript scrollTo with animation
- Is there any way to turn a webpage that is styled partially with Javascript into pure HTML and CSS?
- Writing embeddable Javascript plugin with React & Webpack
- Embeddable JavaScript widget with React
- can't get response status code with JavaScript fetch
- ReactJS/Redux - Pure vs Impure Javascript functions?
- Targeting Pure elements in next.js with CSS modules
- Framer Motion exit animation not firing on accordion with react-router-dom
- How to configure atom-beautify package to format with babel/jsx javascript files?
- Why do modern JavaScript Frameworks discourage direct interaction with the DOM
- How to add external javascript file with reactjs
- How do I rewrite a react component with decorators as a pure function?
- How to redirect page with Javascript in React-Router?
- Must React components act like pure functions with respect to their props?
- Javascript / webpack : how to concatenate all json files in directory with a custom loop over files
- ReactJS TypeScript pure component with children
- Importing JavaScript files with the same name as directory they're inside
- How to reload input value in React / Javascript with Virtual DOM?
- Javascript - ReactJS - display image with ReadableStream as source
- Can we use pure Bootstrap with React.js?
- distribute nodes around the tree root with d3-hierarchy with animation
- How to design a ReactJS component that listens to a WebSocket and interacts with CSS animation
- React - setting input value with JavaScript does not trigger 'onChange'
- Navigate with javascript using the MemoryRouter in react-router
- Upload Image and indicating response in a table with axios and JavaScript
- React scroll animation with setState is choppy
- React-Testing-Library(RTL): Animation causing TypeError with React Pose
- Data structure for highlights of words in a string with JavaScript
- Handling React animation with horizontal scrolling
- How to make loading animation with react-bootstrap
More Query from same tag
- How use :hover in :last-child in material-ui?
- What is the correct PropTypes for dictionary in reactjs
- Adding a key to Object with React Reducer?
- How can parent component reset many children in React
- How can I remove an attribute from a React component's state object
- How can I use a state in a url to make a get using axios in reactjs
- How to switch from CSV to JSON in D3? Github like chart
- how to solve Component should be written as a pure function error in eslint-react?
- Reactjs promise.all
- KeyboardAvoidingView with ScrollView
- Imported function can't get this.state
- React - How to Populate and Show a Modal, then Send AJAX Request on Submit
- Error to hover items one by one in react hooks
- How to fix 'TypeError: Cannot read property 'id' of undefined' error in NextJS?
- Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>
- How to access the Redux store from deeply nested components
- React router dom params issue
- react-select don't show keyboard on mobile devices and prevent zoom
- How could I edit a recipe object inside an array of recipe objects
- Having issues to access props when calling a component in React
- Replace all PlateJS editor contents with another one
- How to keep webcam video centred when the height is 100% of the screen and the window is resized
- How to disable and grey out ReactSelect component
- How to add custom checkbox in column in react material table?
- SVG types support in Flow.js?
- Remove missing Images from array React.js
- How to pass argument to useSate's setState function?
- React- .map is not a function
- Triggering event with react-ga returns "Command ignored. Unknown target: undefined"
- react TypeError: Cannot read property 'fulfilled' of undefined on Redux tool kit