Multi-App using each remix-app as an NPM packages #10705
Unanswered
ajmeraaxesh
asked this question in
Q&A
Replies: 1 comment
-
Context
Why
Fix (minimum viable) Example: blocking everythingimport { json } from "@remix-run/node"
export async function loader() {
const posts = await getPosts() // page waits here
return json({ posts })
} Example: streaming non-critical dataimport { defer } from "@remix-run/node"
export async function loader() {
const posts = getPosts() // promise, not awaited
const settings = await getSettings() // small, needed immediately
return defer({ settings, posts }) // posts will stream later
} Client usage with Suspenseimport { useLoaderData, Await } from "@remix-run/react"
export default function Page() {
const { settings, posts } = useLoaderData<typeof loader>()
return (
<div>
<h1>{settings.title}</h1>
<React.Suspense fallback={<p>Loading posts…</p>}>
<Await resolve={posts}>
{data => <ul>{data.map(p => <li key={p.id}>{p.title}</li>)}</ul>}
</Await>
</React.Suspense>
</div>
)
} Checklist
Docs
If this helps, please Mark as answer so others can find it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi React-Router Community,
I am looking to build a multi-app (A shell app) containing login-logout functionality and a dashboard screen.
This dashboard screen would look (similar to car-play) but want to export all the routes of each app directly into the shell app.
I am not sure what approach to take and if there are any examples.
https://github.com/remix-run/react-router/tree/main/examples/multi-app
Instead of like a mono-repo, Is it possible create each app as its NPM package and then import the routes with my own custom-prefix
So my shell app routes.ts would look something like
Now when I have something like
The contact app can get rendered inside the shell app.
If there are any architecture or any possible way to amek this happen. Any videos or examples would be really appreciated
Beta Was this translation helpful? Give feedback.
All reactions