Search

1,917 code results for react client side

Code
1,917

# React Router SSR Starter
Minimal React Router starter example with server-side rendering for Val Town
s the main server that responds with an HTML stream, using React Router's `StaticRouter` compone
L includes a `<script type="module">` tag that loads the `client.tsx` file to hydrate the app
with client-side routing provided by React Router's `BrowserRouter` in declarative mode.
# React Hono Starter
This app is a starter template for client-side React and server-side Hono.
- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/ind
[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured e
render the app, including HTML, JavaScript (including all client-side React), CSS, and even the
s or deployment platforms automatically make any content inside a `public/` folder public.
t that data on the frontend. This is a common pattern for client-side rendered apps.
end/database/queries.ts`. These routes are called from the React app to refresh and update data.
# React Hono Val Town Project Starter Template
TTP server, which serves the HTML, CSS, and JS, which run client-side.
This template is a classic client-side-only React app.
This HTML file has a `<div id="root"></div>`, which is where we mount the React app.
ntrypoint** for all frontend JavaScript, including all the React. It is not a problem that it im
the **entrypoint** for frontend JavaScript. It imports the React app from `/frontend/components/
This directory is where the React components are stored. They're pretty standard client-side Rea
This template is a classic client-side-only React app.
This HTML file has a `<div id="root"></div>`, which is where we mount the React app.
ntrypoint** for all frontend JavaScript, including all the React. It is not a problem that it im
the **entrypoint** for frontend JavaScript. It imports the React app from `/frontend/components/
This directory is where the React components are stored. They're pretty standard client-side Rea
# React Hono Val Town Project Starter Template
TTP server, which serves the HTML, CSS, and JS, which run client-side.
render the app, including HTML, JavaScript (including all client-side React), CSS, and even the
s or deployment platforms automatically make any content inside a `public/` folder public.
t that data on the frontend. This is a common pattern for client-side rendered apps.
end/database/queries.ts`. These routes are called from the React app to refresh and update data.
# Preact Client Starter
Minimal Preact starter example with client-side hydration
The `http.tsx` file renders the `HTML` Preact component on the server.
This component includes a `<script>` tag that requests the `client.ts` module in the browser.
This module hydrates the `<div id="app">` element with the `App` component
to allow you to use client-side state.
This template is a classic client-side-only React app.
This HTML file has a `<div id="root"></div>`, which is where we mount the React app.
ntrypoint** for all frontend JavaScript, including all the React. It is not a problem that it im
the **entrypoint** for frontend JavaScript. It imports the React app from `/frontend/components/
This directory is where the React components are stored. They're pretty standard client-side Rea
# React Hono Val Town Project Starter Template
TTP server, which serves the HTML, CSS, and JS, which run client-side.
render the app, including HTML, JavaScript (including all client-side React), CSS, and even the
s or deployment platforms automatically make any content inside a `public/` folder public.
t that data on the frontend. This is a common pattern for client-side rendered apps.
end/database/queries.ts`. These routes are called from the React app to refresh and update data.
A simple community message board application built with React Router 7, demonstrating a full-sta
- **Server-Side Rendering**: All pages are server-rendered when accessed directly
- **Client-Side Navigation**: After initial load, navigation happens client-side
- **Topic Management**: Create and view discussion topics
│ ├── index.html # HTML template
│ └── index.tsx # Client entry point
├── routes/
### Server-Side Rendering
The application uses React Router 7's `createStaticHandler`, `createStaticRouter`, and `StaticRo
2. It runs the appropriate loaders/actions for the matched route
3. The page is rendered with the data and sent to the client
4. The client hydrates the page with `createBrowserRouter` and `RouterProvider`
### Client-Side Navigation
After the initial page load, navigation happens entirely on the client:
1. React Router handles link clicks and form submissions
2. Data is fetched asynchronously using loaders and actions
- **Hono**: For server-side routing and handling
- **React Router 7**: For both server and client-side routing
- **SQLite**: For data persistence
g as a reference for building full-stack applications with React Router 7. The project uses a Re
# React Hono Starter
This app is a starter template for client-side React and server-side Hono.
- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/ind
[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured e
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { Hono } from "https://esm.sh/hono@3";
// Client-side App component
function App() {
// Client-side rendering
function client() {
createRoot(document.getElementById("root")).render(<App />);
}
if (typeof document !== "undefined") { client(); }
// Server-side code
const app = new Hono();