--with react vendors React as a plain file and fetches the type declarations your editor needs. Without it you get the same project with no framework in it.
React lands as a single file under app/vendor/ and the import map names it, which is how the browser finds it.
There are three config files. config/app.toml is always read. config/development.toml is read as well when RELEASE_ENV is development or unset. It turns on live refresh and the readable build. config/production.toml is read instead when RELEASE_ENV or APP_ENV is production: it serves the minified build, gives static files a cache lifetime and marks the session cookie secure. Its [session] key is a placeholder the host refuses to start on, so set C5_SESSION__KEY before you deploy.
If you forget the flag, fsr use hello/app react does the same thing afterwards. It also takes vue, elements, htmx and tera, which the later tutorials use.
Every import already resolves when you open the project, because of the generated/ and tsconfig.json lines.
importtype{Ctx}from"@snapfire/fsr/host";exportasyncfunctionload(_ctx:Ctx<"/">){return{greeting:"Hello from Rust",routes:["/","/about","/posts/{id}"],};}
The page takes the loader's return value as its props. The build writes the props type from the loader, so you don't write it yourself.
app/routes/page.tsx
importtype{RootProps}from"@generated/client";exportdefaultfunctionIndex({greeting,routes}:RootProps){return(<sectionclassName="hero"><h1>{greeting}</h1><p>These came out of the loader, on the server.</p><ul>{routes.map((route)=>(<likey={route}><code>{route}</code></li>))}</ul></section>);}
lowered means the loader and the page became data rather than JavaScript. static means the module has no state and no handlers, so the browser never runs it at all. hoisted means the parts of your markup that never change were folded into constants before the server answers a request.
$fsr dev hello/app --verbosedev: watching hello/app and its configuration, served by the stock host; press Ctrl-C to stopdev: server started, pid 33601static /static/js/app hello/app/dist /static/js/vendor hello/app/vendor /static/css hello/app/stylesclient /static/js/fsr 17 modules, readable, 98 KiB from the binarycache 1000 entries, ttl 1mdev live refresh on /__fsr/events, told by POST /__fsr/changedfsr server on http://127.0.0.1:3000/fsr traces on http://127.0.0.1:3000/__fsr/traces
Open it and you get your greeting and your three routes. Edit the page and the browser updates on its own.
The client row shows that the browser half of FSR comes out of the host binary, so it always matches the version you're running.
The last line is the trace collector, which a development server turns on for itself. 420 is about reading what it keeps.
Next up: 020. Build a counter, where the page gains a button and still ships no component code.