1/** @jsxImportSource npm:react **/
2import process from "node:process";
3import { renderToString } from "npm:react-dom@18/server";
4import { QueryVectorStore, sb, Substrate } from "npm:substrate";
5
10 {
11 user: "website that shows the current time",
12 content: `/** @jsxImportSource npm:react */
13export default function() {
14 return <h1>{new Date().toLocaleTimeString()}</h1>;
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
1/** @jsxImportSource https://esm.sh/react */
2
3import fal from "npm:@fal-ai/serverless-client";
4import { renderToString } from "npm:react-dom/server";
5
6export default async function(interval: Interval) {
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
3
4export function getStaticProps() {
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
1/** @jsxImportSource https://esm.sh/react */
2import React from "https://esm.sh/react";
3
4const Counter = () => {
5 const [count, setCount] = React.useState(0);
6 return (
7 <button onClick={() => setCount(count + 1)}>
15 <head />
16 <body>
17 <h1>Val Town React Client Demo</h1>
18 <Counter />
19 </body>
22
23if (typeof document !== "undefined") {
24 const { hydrateRoot } = await import("https://esm.sh/react-dom/client");
25 hydrateRoot(document, <App />);
26}
27
28export default async function(req: Request): Promise<Response> {
29 const { renderToReadableStream } = await import("https://esm.sh/react-dom/server");
30 const stream = await renderToReadableStream(<App />, { bootstrapModules: [import.meta.url] });
31 return new Response(stream, { headers: { "content-type": "text/html" } });
1/** @jsxImportSource https://esm.sh/react */
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
3
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
1/** @jsxImportSource https://esm.sh/react */
2
3import fal from "npm:@fal-ai/serverless-client";
4import { renderToString } from "npm:react-dom/server";
5
6export default async function(interval: Interval) {
Starter template with client-side React & Hono server
A web-based dice roller using React on Val Town
Write business logic with ease
Meet the new standard for modern TypeScript development.
Type-safe, reactive, framework-agnostic library to manage your business logic.
Follow me if you learn more about JavaScript | TypeScript | React.js | Next.js | Linux | NixOS | Frontend Developer | https://linktr.ee/officialrajdeepsingh