SPA Navigation best practice

What’s considered best practice for handling navigation in a Single Page App.
I have multiple sections that can show / hide based on boolean variables being triggered but I think it’d be more useful to show / hide based on a single variable value.

in my current setup, I have multiple booleans like as follows:
“Section1” = true
“Section2” = false
“Section3” = false etc.

If I had a single variable called navigation is set to “Section1”, then only Section1 is visible and the other sections wouldn’t render.
I’d rather the text “Section1” to be a dropdown option from a list instead of manually writing “Section1” in to the workflow in case I want to rename them later.

You should take a look at our Multipage sections, they will not re-render when switching pages with the same sections

Thanks for replying @luka.
Are you suggesting that the best approach is to use different pages with the same ‘multi-page sections’, and the components can be hidden/shown based on whatever page is active?

Hi @luka is this also true for modals and sidebars?

If you make a modal or sidebar section a multipage section, yes

Take a look at this link: Multi-page sections | WeWeb documentation

1 Like

I don’t think it’s necessary to do that for components, just design pages like you want them and use the navigation separately. What are you building?

I think I used the wrong terminology saying components, and I could be using sections incorrectly too.
I had a section to represent each page and inside a section would be containers / buttons / text etc. these elements should hide/show based on the current active page.

I’m building a check-in app and on the home page is the check-in buttons that should navigate to different pages depending on whether it’s a guest or member of staff checking-in.
I figured there should be a easy way to show/hide sections if CurrentPage = XYZ but haven’t found it in the documentation.

Have you considered using different pages normally and then just making persistent variables in combination with multi-page sections to keep between the pages?

I don’t quite follow what you mean.
Can you give an example by any chance?

Maybe this video from Academy would help