rafgraph / react-router-hash-link

Hash link scroll functionality for React Router
https://react-router-hash-link.rafgraph.dev
MIT License
732 stars 62 forks source link

Workaround with React.lazy #103

Open errand opened 1 year ago

errand commented 1 year ago

The problem is that when the first render there is a Suspence instead of actual Components, so no Hash anchor exists yet. In this case then user comes outside the site he doesn't scroll down to the anchor component.

I tried to add anchors outsite the

<h2 id={'second'}></h2>
<Suspense fallback={<div>Загрузка...</div>}>
    <Section2 />
</Suspense>

but no. Any ideas?