You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What kind of documentation issue are you reporting?
Reporting a typo
Reporting a documentation bug
Documentation improvement
Documentation feedback
Is there a specific documentation page you are reporting?
Developer --> Server-Side Rendering page
Description
Hi guys,
Can you please add my recipe for server-side rendering with remix-run framework to the documentation? It supports everything without issues. This is the only fully working solution on github. Most other repos contain an outdated code.
Modify the entry.client.tsx file under your app folder:
/** * By default, Remix will handle hydrating your app on the client for you. * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ * For more information, see https://remix.run/file-conventions/entry.client */import{RemixBrowser}from'@remix-run/react'import{startTransition,StrictMode}from'react'import{hydrateRoot}from'react-dom/client'consthydrate=async()=>{awaitstartTransition(()=>{hydrateRoot(document,<StrictMode><RemixBrowser/></StrictMode>)})}if(window.requestIdleCallback){window.requestIdleCallback(hydrate)}else{window.setTimeout(hydrate,1)}
Finally add your code to the root.tsx file in your app folder:
importtype{MetaFunction}from'@remix-run/node'import{Links,Meta,Outlet,Scripts,ScrollRestoration}from'@remix-run/react'import{FluentProvider,webLightTheme}from'@fluentui/react-components'exportconstmeta: MetaFunction=()=>[{title: 'Create Remix App'},{name: 'description',content: 'A sample app to demonstrate ssr rendering in remix'}]constisBrowser=()=>{return(typeofwindow!=='undefined'&&window.document&&window.document.createElement)}exportfunctionLayout({children}: {children: React.ReactNode}){return(<htmllang="en"><head><metacharSet="utf-8"/><metaname="viewport"content="width=device-width, initial-scale=1"/>
<Meta/><Links/>{!isBrowser()&&'__STYLES__'}</head><body>{/* 👇 Apply fluent theme to children */}<FluentProvidertheme={webLightTheme}>{children}</FluentProvider><ScrollRestoration/><Scripts/></body></html>)}exportdefaultfunctionApp(){return<Outlet/>}
Validations
Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
The text was updated successfully, but these errors were encountered:
Area
React Components (https://react.fluentui.dev)
What kind of documentation issue are you reporting?
Is there a specific documentation page you are reporting?
Developer --> Server-Side Rendering page
Description
Hi guys,
Can you please add my recipe for server-side rendering with remix-run framework to the documentation? It supports everything without issues. This is the only fully working solution on github. Most other repos contain an outdated code.
Demo / Starter template
https://github.com/r007/remix-fluentui-v9
Setting up Vite config for Remix
To make it work need to unwrap default imports from Fluent UI during SSR. Install CJS interop plugin for Vite:
Then open up
vite.config.ts
and paste this code:Setting up Fluent UI
entry.server.tsx
file under your app folder with the following content:entry.client.tsx
file under your app folder:root.tsx
file in your app folder:Validations
The text was updated successfully, but these errors were encountered: