Panel to route to pages in react (side bar menu)

hello I am gonna make a panel with items to route to my pages in react.
currently I am doing like this for each item:
onClick={() => {
this.$f7.views.main.router.navigate("/loginForm/");
this.$f7.panel.close(“right”, true);
}}
this is too noisy.
but I assume there must be a better approach ,is there any?

<Link href="/loginForm" panelClose>text here</Link>

thank you for your reply but that doesn’t work!
It will place the desired page on the panel not in the main view!!!

<Link href="/loginForm" panelClose view=".view-main">text here</Link>