flexx icon indicating copy to clipboard operation
flexx copied to clipboard

Routing and linking subsystem

Open Korijn opened this issue 8 years ago • 4 comments

Something that Flexx currently lacks in comparison to other UI toolkits is linking and routing.

An app with pages, links and URLs is typically implemented with a Router for single page applications. This usually also syncs with browser history to ensure the Back button functions, and so that users can share links. An example of this is react-router:(https://github.com/reactjs/react-router/blob/master/README.md).

What work do you think would be required for such a subsystem?

Korijn avatar Aug 22 '16 15:08 Korijn

I can imagine an app where you host multiple apps and have links between them. Would that give you what you mean? Maybe Flexx needs a way to write something like that (or the links) down more effectively?

almarklein avatar Aug 29 '16 22:08 almarklein

Well, as mentioned earlier, I think this is closely related to #182. Switching out whole hierarchies of subwidgets would be the main purpose of a Router widget. Triggering this can be done programmatically, and a Link widget would be designed ready-to-go.

Side-effects of the Router would include URL and history tracking.

IMHO, linking between multiple apps seems unrelated and more like something you can accomplish by implementing e.g. #178.

Korijn avatar Aug 30 '16 05:08 Korijn

Summarising in my own words: this feature would be a per-app ability to map the remainder of the url (after the app name) to the "configuration" of the app itself. E.g. http://foo.com/users would show a list of users, and http://foo.com/users/23 would show user 23.

almarklein avatar Aug 30 '16 09:08 almarklein

A nice example can be found here: https://github.com/reactjs/react-router/blob/master/examples/active-links/app.js

Korijn avatar Aug 30 '16 10:08 Korijn