Search
numbergame
@moe
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useRef, useState } from "https://esm.sh/react"
import { createRoot } from "https://esm.sh/react-dom/client"
// Game board size
setSelectedCells([[row, col]])
const handleTouchMove = (e: React.TouchEvent) => {
if (!isDragging || !boardRef.current) return
const board = boardRef.current
const rect = board.getBoundingClientRect()
const x = touch.clientX - rect.left
const y = touch.clientY - rect.top
const cellSize = rect.width / BOARD_SIZE
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />)
if (typeof document !== "undefined") { client() }
async function server(request: Request): Promise<Response> {
zodSchemaPlayground
@feb
Zod Schema to Typescript Playground A simple site to convert zod schema to typescript type definitions. The type getting converted will be the one returned in the body of the input, so make sure that you return the schema at the very end.
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { printNode, zodToTs } from "https://esm.sh/zod-to-ts";
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default function server(request: Request): Response {
reactTodoListWebsite
@liamdanielduffy
// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
Script
import { REACT_TODO_LIST_CONTENTS } from "https://esm.town/v/liamdanielduffy/REACT_TODO_LIST_CONTENTS";
import { addReactFromValCDN } from "https://esm.town/v/liamdanielduffy/addReactFromValCDN";
import { buildHtml } from "https://esm.town/v/liamdanielduffy/buildHtml";
// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
export function reactTodoListWebsite(req, res) {
res.set("Content-Type", "text/html");
res.send(buildHtml({
scripts: [addReactFromValCDN()],
styles: REACT_TODO_LIST_CONTENTS.styles,
body: REACT_TODO_LIST_CONTENTS.body,
reluctantCoffeeGayal
@kaz
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
HTTP
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
/** @jsxImportSource https://esm.sh/react */
import React, { useCallback, useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import {
useNavigate,
} from "https://esm.sh/react-router-dom";
// Types
const [username, setUsername] = useState("");
const handleLogin = useCallback(async (e: React.FormEvent) => {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
blobCommentsReact
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { Hono } from "https://esm.sh/hono";
import React, { useEffect, useState } from "https://esm.sh/react";
import { hydrateRoot } from "https://esm.sh/react-dom/client";
import { renderToReadableStream } from "https://esm.sh/react-dom/server";
import { blob } from "https://esm.town/v/std/blob?v=10";
textSummarizationComparisonTool
@sharanbabu
* This val creates a text summarization comparison tool using the Cerebras LLM API.
* It provides a text area with default text, a summarize button, and displays two different summarization results:
* 1. Direct summarization
* 2. Extractive summarization followed by cohesive rewriting
*
* The server handles API calls to Cerebras, while the client manages the UI and user interactions.
HTTP
* The server handles API calls to Cerebras, while the client manages the UI and user interactions.
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function client() {
client();
const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
const summary1Response = await client.chat.completions.create({
const extractiveResponse = await client.chat.completions.create({
const summary2Response = await client.chat.completions.create({
smoothLavenderPanther
@polqb2000
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 **/
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
const handleClick = () => {
window.location.href = "https://www.google.com";
VALLErun
@arash2060
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
consider it part of the current conversation. The conversation below is your recent interaction with the user.
You can use React but you don't have to.
currentCode = `/** @jsxImportSource https://esm.sh/react */
import React from "npm:react";
import { renderToString } from "npm:react-dom/server";
You can use React but you don't have to.
DON'T respond with a preamble (aside from saying "Certainly", "Of course", "Let's do it", or something similar) or further explanation, unless the user EXPLICITLY asks for it.
/** @jsxImportSource https://esm.sh/react */
multirouteHono
@cofsana
🌐 Multi-Route Website with Hono
HTTP
* This val creates a simple website for Janic Business Group, a business consulting firm.
* It uses React for the frontend and Hono for the backend routing.
* The website includes a home page, about page, and services page.
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Hono } from "https://esm.sh/hono";
function App() {
const [page, setPage] = React.useState('home');
const renderPage = () => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
app.get('*', (c) => {
dot_com
@aginfer
stevekrouse.com - my personal website This val hosts my personal website. The view data is stored in Val Town SQLite - @std/sqlite. It used to live on Github Pages, which is why I proxy over requests to certain blog posts over to the Github Pages site still. Todos [ ] Speed up page load by loading sqlite data later like in @healeycodes/steve_web [ ] Store more (legally storable) analytics data, and maybe make a sparkline! [ ] Add some sort of way to contact me [ ] Move over all my blog posts from Github Pages (maybe into @std/blob as a CMS?)
HTTP
/** @jsxImportSource https://esm.sh/react */
import { email } from "https://esm.town/v/std/email?v=11";
import tailwindURL from "https://esm.town/v/stevekrouse/tailwindURL";
import { renderToString } from "npm:react-dom/server";
const linkClass = "text-blue-500 hover:underline";
{ children, href }: {
children?: React.ReactNode;
href: string;
buildReactDomMinified
@liamdanielduffy
An interactive, runnable TypeScript val by liamdanielduffy
Script
import { REACT_DOM_MINIFIED } from "https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED";
let { REACT_DOM_MINIFIED_PT4 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT4");
let { REACT_DOM_MINIFIED_PT3 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT3");
let { REACT_DOM_MINIFIED_PT2 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT2");
let { REACT_DOM_MINIFIED_PT1 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT1");
export async function buildReactDomMinified() {
"https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js",
REACT_DOM_MINIFIED_PT1 = src.substring(0, pt1End);
REACT_DOM_MINIFIED_PT2 = src.substring(pt1End, pt2End);
REACT_DOM_MINIFIED_PT3 = src.substring(pt2End, pt3End);
legendaryRoseSwordfish
@ronr
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default async function server(req: Request): Promise<Response> {
marineMoccasinLizard
@kaz
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
HTTP
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
/** @jsxImportSource https://esm.sh/react */
import React, { useCallback, useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import {
useNavigate,
} from "https://esm.sh/react-router-dom";
// Types
const [username, setUsername] = useState("");
const handleLogin = useCallback(async (e: React.FormEvent) => {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
surfboardDemoSchedule2
@keenanzucker
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { useEffect, useState } from "https://esm.sh/react";
import { renderToString } from "npm:react-dom/server";
async function getSchedule() {
<body>
<h1>Val Town React Client Demo</h1>
<Schedule data={data} />
const scheduleData = await getSchedule();
const { renderToReadableStream } = await import("https://esm.sh/react-dom/server");
const stream = await renderToReadableStream(<App data={scheduleData} />, { bootstrapModules: [import.meta.url] });