(Noob Question) Why do i need to use routers(flow-router, iron-router,etc) when i can route using html?

I hope the question makes sense. In my brief research online , I read about client-side rendering and server-side rendering and at first i thought this was the difference. But in the meteor API documentation i read that Flow-router can be used for client-side as well as server-side routing . Forgive me for my noobness when i ask , can i not already route using just html tags? Or are these even related?

1 Like

Part of it can be simplicity, it’s really easy to set up screen navigation when using a router.

The other big piece is URL-based routes. If your app lives under one url, then (unless you do some special coding) your user will always end up on the main screen when they refresh. So if your app allows the user to create lists, the main page might display all the lists and a second page might display the contents of an individual list.
If you don’t use routing and don’t have some other special workaround in place, a user who views a specific list then refreshes the page will end up back on the All Lists screen.

The flow would be like this:
Display All Lists -> Display Individual List -> (Refresh) -> Display All Lists

With a separate route for the individual list page, I get a flow like this:
Display All Lists -> Display Individual List -> (Refresh) -> Display Individual List

This also adds the capability to do things like share the list with someone else via a link.

3 Likes

cool…ill keep that in mind…thank you…

Flow Router is primarily client-side where server requests don’t need to be made when navigating throughout your app; you might use server-side routes for pages you don’t want to send in the initial client bundle

1 Like

right…makes sense…I kind of guessed that…but could you give me an example of where I would not want to send everything in the initial client bundle and make server calls later?..thanks a lot for helping me…I have a few more questions related to this topic…but ill ask that after I’ve studied flow router a little more…thanks again…

Admin/private pages, for example

If only one of your routes uses a heavy library (f.e. a photo editor), you don’t want it loaded for everyone from the start.