When to use Views and Pages in a data driven app

Hi Guys

I have a question regarding how to organize the app and use views or pages.
I have a very simple database driven app that i struggle a bit in organising (im new to databases etc)

I have this image to describe the build.

And im currious to know if the correct approach (best practice) to use views and pages in this setup.
Right now everything is views but i struggle to initialize the data correctly so was thinking my approach was wrong :slight_smile:

Think about it like:

  • View (<div class="view">) - is basically a “standalone” part of the app with its own router, navigation and pages.
  • Page (<div class="page">) - is what View operates with.

Multiple Views usage decision usually not depends on what is behind it (database, api, etc.). It is about semantic and UX, like Tabbed Views template https://framework7io.github.io/framework7-template-tabs/. Multiple Views allow to switch between separate or not really relevant parts/sections of the app.

In your case it sounds like it should be done with Pages within single View.

1 Like

the decision of build app in single page or multi page its mensured by the numbers of pages? i mean, in my company we need to decide with go single or multi, other devs prefer have a single page .html with 1000+ lines against use multi page with routes, how can i explain for all the beneficts of use multi?

It is not about files but about app visual structure. You can go with anything you like or fits best for you needs

2 Likes