Earlier quoted context omitted.
In reality, an important and large class of apps will hit the backend on roughly every click anyway, and having full control over in-browser interactivity is kind of overkill for those apps. Business apps with tables, charts, and forms, for example. You click the nav to load a new page, you scroll down or click a button to load more data, you fill a form and click submit, all those things hit the server. For those ty…
What about conditional form elements, modal dialogs with static text, or collapsible menus? I understand the benefits, then again if interacting with these elements requires calling the backend then the cost is quite high.
But some frameworks may open the prefilled menu when you click it, and sync the state to the backend, instead of waiting for the backend to “approve” the request to open the menu.
Hypothetical example:
m = menu(1, 2, 3)
if m.opened:
print(“It was opened.”)
Here there may not be any UI latency when opening the menu. The menu opens when you click it, and the state is synced to the backend. However, m = menu(1, 2, 3)
b = button(“open the menu”)
if b.clicked:
m.opened = True
In this program, there will be a round trip to the backend when you click the button to indirectly open the menu.Overall, it depends on how you design the framework and how you divide interaction control between backend and frontend. Controlling every little interaction thru the backend is probably not a good idea, and you should bake some frontend interactions into the UI components.