How to return to the same scroll position when going back using useNavigate() or useLocation() react-router
When clicking on a specific pokemon, the user can show details of the pokemon. When the user clicks the back button to see all pokemon, I want them to continue in the exact same scroll position/pokemon, where they first clicked. How to achieve this? Here is the pokedex component, where the user can click on each pokemon: import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { ScrollArrow } from './utils/scrollArrow'; import { Container, Card, Col, Row, Spinner } from 'react-bootstrap'; const Pokedex = () => { const [pokemon, setPokemon] = useState([]); co
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.