Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=react&page=374&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=react

Returns an array of strings in format "username" or "username/projectName"

Found 4495 results for "react"(418ms)

forkyREADME.md4 matches

@smh•Updated 1 month ago
1# React Hono Starter
2
3This app is a starter template for client-side React and server-side Hono.
4
5The **entrypoint** is `/backend/index.ts`. That's the backend HTTP server, which also serves the all the frontend assets.
6
7The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
8
9[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.

forkyindex.tsx2 matches

@smh•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import { App } from "./components/App.tsx";
4

forkyindex.html1 match

@smh•Updated 1 month ago
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>React Hono Val Town Starter</title>
7 <script src="https://cdn.tailwindcss.com"></script>
8 <link rel="icon" href="/public/favicon.svg" sizes="any" type="image/svg+xml">

forkyApp.tsx2 matches

@smh•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {

cerebras_coderindex10 matches

@webrixo•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
3import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
4import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
5import STARTER_PROMPTS from "./starter-prompts.js";
6
30}: {
31 prompt: string;
32 setPrompt: React.Dispatch<React.SetStateAction<string>>;
33 handleSubmit: (e: React.FormEvent) => void;
34 handleStarterPromptClick: (promptItem: PromptItem) => void;
35}) {
116
117function App() {
118 const previewRef = React.useRef<HTMLDivElement>(null);
119 const [prompt, setPrompt] = useState("");
120 const [projectId, setProjectId] = useState<number | null>(null);
174 }
175
176 async function handleSubmit(e: React.FormEvent | string) {
177 if (typeof e !== "string") {
178 e.preventDefault();
673 </div>
674 <div className="bg-white w-full h-full flex flex-col grow rounded-xl border-2 border-white overflow-hidden">
675 <React.Fragment key={iframeKey}>
676 <iframe
677 srcDoc={code}
679 className="w-full grow"
680 />
681 </React.Fragment>
682 </div>
683 </div>

OpenTownieNormalsystem_prompt.txt9 matches

@dcm31•Updated 1 month ago
107- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
108- For persistence, use Val Town SQLite or Blob storage with `import.meta.url` for keys/table names
109- **React Configuration:** When using React libraries, pin versions with `?deps=react@18.2.0,react-dom@18.2.0` and include the `@jsxImportSource` pragma
110- When facing client-side render issues, check if all React dependencies are pinned to the same version
111- **Styling:** Default to using TailwindCSS via `<script src="https://cdn.twind.style" crossorigin></script>` unless otherwise specified
112
220
221### Frontend Best Practices
222- Structure as a standard client-side React app
223- Use SVG for favicons (Val Town only supports text files)
224- Separate components into individual files
225- Access bootstrapped data from `window.__INITIAL_DATA__`
226- Use React 18.2.0 consistently in all imports and the `@jsxImportSource` pragma
227- Follow the React component pattern from the example project
228- Handle API calls properly with proper error catching
229
247 - Always run table creation before querying
248
2493. **React Configuration:**
250 - All React dependencies must be pinned to 18.2.0
251 - Always include `@jsxImportSource https://esm.sh/react@18.2.0` at the top of React files
252 - Rendering issues often come from mismatched React versions
253
2544. **File Handling:**

OpenTownieNormalREADME.md1 match

@dcm31•Updated 1 month ago
8
9- [ ] Give it all the code (except maybe .txt files) as initial context (like cursor sonnet max)
10- [ ] Rebuild as React Router?
11- [ ] Persistent threads?
12- [ ] Have it default to creating a new branch off main and then embedding and iframe to the resulting http val and give you a link to a pr opening url

OpenTownieNormalProjects.tsx2 matches

@dcm31•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
3
4// Component for the loading spinner

OpenTownieNormalMessagePart.tsx6 matches

@dcm31•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2import { type Message } from "https://esm.sh/@ai-sdk/react?dev&deps=react@18.2.0&react-dom@18.2.0";
3import ReactMarkdown from "https://esm.sh/react-markdown?dev&deps=react@18.2.0&react-dom@18.2.0";
4import { ImagePreview } from "./ImageUpload.tsx";
5
6export function MessagePart({ part }: { part: NonNullable<Message["parts"]>[number] }) {
7 if (part.type === "text") return <ReactMarkdown>{part.text}</ReactMarkdown>;
8 if (part.type === "reasoning")
9 return (
13 </summary>
14 <div>
15 <ReactMarkdown>{part.reasoning}</ReactMarkdown>
16 {part.details && part.details.map((detail, index) => (
17 <div key={index} className="mt-2">
18 <ReactMarkdown>{detail.text}</ReactMarkdown>
19 </div>
20 ))}

OpenTownieNormalLogin.tsx2 matches

@dcm31•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2import { useLocalStorage } from "https://esm.sh/react-use?dev&deps=react@18.2.0&react-dom@18.2.0";
3
4export function Login() {

react-router-starter-remix-13 file matches

@jxnblk•Updated 1 day ago

reactHonoStarter4 file matches

@stfnsr•Updated 2 days ago