RouterLink not updating URL in browser

Hello, in my application when clicking on a RouterLink, It doesn’t update the URL in the browser when the docs says it should.
My code’s here:

            RouterLink link = new RouterLink();
            // Use Lumo classnames for various styling
            link.addClassNames("flex", "mx-s", "p-s", "relative", "text-secondary");
            link.setRoute(view); // Class<? extends Component>

            Span text = new Span(menuTitle);
            // Use Lumo classnames for various styling
            text.addClassNames("font-medium", "text-s");

            link.add(new LineAwesomeIcon(iconClass), text);
            add(link);