Search

Results include substring matches and semantically similar vals. Learn more
tfayyaz avatar
whiteMongoose
@tfayyaz
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
lifonnnn avatar
cardRepaymentCalculator
@lifonnnn
* This credit card payoff calculator app allows users to: * 1. Add and remove multiple credit cards with their balances and interest rates * 2. Calculate monthly payments based on desired payoff time * 3. View individual card payoff information * 4. See a combined view of all cards * 5. Visualize payoff data with different types of charts * * It uses React for the UI, SQLite for data persistence, and Chart.js for visualization. * The app is now optimized for mobile devices with responsive design.
HTTP
* 5. Visualize payoff data with different types of charts
* It uses React for the UI, SQLite for data persistence, and Chart.js for visualization.
* The app is now optimized for mobile devices with responsive design.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import Chart from "https://esm.sh/chart.js/auto";
setCards(data);
const addCard = 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> {
all avatar
npmExplorer
@all
NPM explorer
HTTP
* It displays a grid of npm packages with basic information, categories, and navigation.
* The approach uses React for the frontend and fetch for API calls.
* It includes a details view for each package, a link to the npm page, and category navigation.
* The app includes a left column for categories and a right column for package details.
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState, useCallback } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const ITEMS_PER_PAGE = 30;
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
reosablo avatar
sampleVanSSR
@reosablo
simple SSR + hydration example with VanJS
HTTP (deprecated)
/** cached client HTML */
let clientHtml: string | undefined;
/** load client HTML */
async function loadClientHtml() {
/** cached client script for App component hydration */
let clientScript: string | undefined;
/** load client script for App component hydration */
async function loadClientScript() {
clientHtml ??= await loadClientHtml();
return new Response(clientHtml, {
Croniac avatar
WundergroundStationDisplayV2
@Croniac
For reasons I don't fully understand, this doesn't always work properly in the val.town preview, however if you use the endpoint in a browser it should be fine. Wunderground stationId are ALL CAPS.
HTTP
// and display a simplified version of the current conditions in separate tiles. We'll use
// the fetch API to make the HTTP request and React for rendering the UI.
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function calculateDensityAltitude(elevation, temperature, pressure) {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
rauchg avatar
web
@rauchg
@jsxImportSource npm:react
HTTP (deprecated)
/** @jsxImportSource npm:react **/
import { renderToString } from "npm:react-dom@18/server";
export default (req: Request) => {
return new Response(
gr8gatsby avatar
hungryWhiteLeopon
@gr8gatsby
* This application helps users write detailed reviews of coffee shops. It fetches coffee shop data * from the OpenStreetMap Nominatim API, allows users to add custom details, and stores the augmented * information in a SQLite database. The app provides a user interface to view, add, and edit coffee shop reviews. * * It uses React for the frontend, the Nominatim API for initial coffee shop data, * and Val Town's SQLite for data persistence.
HTTP
* information in a SQLite database. The app provides a user interface to view, add, and edit coffee shop reviews.
* It uses React for the frontend, the Nominatim API for initial coffee shop data,
* and Val Town's SQLite for data persistence.
/** @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(); }
async function server(request: Request): Promise<Response> {
sharanbabu avatar
longOliveGuppy
@sharanbabu
// This chatbot app will use a simple React frontend to display messages and allow user input.
HTTP
// This chatbot app will use a simple React frontend to display messages and allow user input.
// The backend will use OpenAI's GPT model to generate responses.
// We'll use SQLite to store conversation history.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } 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(); }
async function server(request: Request): Promise<Response> {
await sqlite.execute(`INSERT INTO ${KEY}_messages_${SCHEMA_VERSION} (role, content) VALUES (?, ?)`, ["user", message]);
const client = new Cerebras.default({
apiKey: Deno.env.get('CEREBRAS_API_KEY'),
const completion = await client.chat.completions.create({
messages: [
cofsana avatar
fancyPlumSquirrel
@cofsana
* This val creates an elegant and professional web app for managing panel members for the State Street discussion. * It uses React for the UI, SQLite for storing panel member information, and the Fetch API to communicate with the server. * The design is clean and sophisticated, with a muted color palette and subtle animations.
HTTP
* This val creates an elegant and professional web app for managing panel members for the State Street discussion.
* It uses React for the UI, SQLite for storing panel member information, and the Fetch API to communicate with the server.
* The design is clean and sophisticated, with a muted color palette and subtle animations.
/** @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();
async function server(request: Request): Promise<Response> {
stevekrouse avatar
memeGenerator
@stevekrouse
* This meme creation tool app will allow users to create memes by selecting an image and adding top and bottom text. * We'll use HTML5 Canvas to render the meme directly in the browser, with custom positioning for different meme templates.
HTTP
* We'll use HTML5 Canvas to render the meme directly in the browser, with custom positioning for different meme templates.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useRef, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
interface MemeTemplate {
image.src = selectedImage.url;
const handleSubmit = (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> {
lilyjordan avatar
onlineStatus
@lilyjordan
test readme info
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export function getStaticProps() {
return {
iamseeley avatar
multirouteReact
@iamseeley
🌐 Multi-Route Website with React
HTTP (deprecated)
🌐 Multi-Route Website with React
* @title Multi-Route Website with React
* @description Create a personal portfolio website with multiple pages and server-side rendered React components.
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
<p><strong>This website is rendered server-side with React.</strong></p>
<p>Check out the <a href='https://www.val.town/v/iamseeley/multirouteReact'>source</a> and start building your own site!<
<title>{personalData.name} | Server-side React</title>
const reactHtml = renderToString(<App currentPath={currentPath} />);
const fullHtml = `<!DOCTYPE html>${reactHtml}`;
overengineered avatar
status
@overengineered
Uptime Status Page This is the status page for the data generated by this uptime cron: @stevekrouse/uptime
HTTP
/** @jsxImportSource npm:preact */
import { sha256 } from "https://esm.sh/@noble/hashes@1.5.0/sha2";
import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
import { html } from "https://esm.town/v/stevekrouse/html";
import { render } from "npm:preact-render-to-string";
await sqlite.execute(
"CREATE TABLE IF NOT EXISTS meter_users (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT, session TEXT, salt TEXT, code TE
gio avatar
razza
@gio
An interactive, runnable TypeScript val by gio
HTTP
gap: 20px;
.left-side, .right-side {
width: 48%;
font-weight: bold;
const clientScript = `
let existingCodes = [];
<div class="content">
<div class="left-side">
<h2>New Chat</h2>
</div>
<div class="right-side">
<h2>Existing Chats</h2>
</div>
<script>${clientScript}</script>
</body>
rapfl avatar
zottify
@rapfl
@jsxImportSource https://esm.sh/preact
HTTP
/** @jsxImportSource https://esm.sh/preact */
import { encode } from "https://deno.land/std@0.107.0/encoding/base64.ts";
import { render } from "npm:preact-render-to-string";
import Replicate from "npm:replicate";
const replicate = new Replicate({