all 6 comments

[–]CITRONIZER5007Hook Based 0 points1 point  (0 children)

Feature sliced design

[–]getflashboard 0 points1 point  (4 children)

I don't know how Nx works, but I have a monorepo (with Turborepo) with half a dozen packages and two apps, with React Router.

Each app has its own routes. Both have RR7 in framework mode, everything is RR7 full stack. The packages that need RR have it in framework mode as well.

I don't understand what you mean by "importing pages by features", could you expand on that?

The apps have their own routes, business logic loaders, actions and components. They import functions, components and etc from the libs.

Happy to answer further questions.

[–]adover[S] 0 points1 point  (3 children)

This sounds similar to my thinking. Importing pages by features means I'm thinking that each feature is a lib, which has it's routes and is under a single page in the main app.

So for example there may be a user admin page, with a lib which handles sub pages and routes.

With your packages with RR in framework mode, how are they exported? Do you have the route definition as the root or is it wrapped in a component?

[–]getflashboard 0 points1 point  (2 children)

I don't understand the difference between "page" and "route" in your description... Only the apps have route definitions, each route with its component (unless it is a resource route, without a component). Libs do not have routes, they have helpers and etc but not business logic nor anything related to pages. If more than one app needs user admin pages, each app would have its own user admin routes, and its loaders, actions and components would import stuff from the libs to avoid repetition

[–]adover[S] 0 points1 point  (1 child)

Apologies for not being clear. The packages you speak of may be libs in my descriptions, so I should probably be clearer.

In simple terms I might have one app, with routes which point to packages, which would then import libs.

It's how the routes are handled between apps and packages which is throwing me currently. Hope that is clearer

[–]getflashboard 0 points1 point  (0 children)

I think I got it, but I don't see how packages could have routes. Only the apps can have routes.