Hei, simply by following exactly guide, you already has the active class working:
https://codesandbox.io/p/devbox/upbeat-glitter-7j2lzn
The customise code that you added possibly mess up the reactive. I would suggest to simplify it as the guideline unless you want to add custom logic there.