A demo showing how to use Quicklink in a single-page website. This project was bootstrapped with Create React App and React Router.
quicklink()
should be called once a navigation to a new route has completed in order to detect links within that route component(viewport).
Here you can use React Router to catch the point that route has changed. Please have a look at how App.js
is set.
If you prefer to use React Hooks, you can use just one Effect Hook instead of two lifecycles(componentDidMount
and componentDidUpdate
).
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-react-router
npm install
npm start
npm run build