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=392&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 4292 results for "react"(563ms)

cerebras_coder

cerebras_coderindex10 matches

@Proking2005•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>

statusstatus2 matches

@cameron•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { parseProject } from "https://esm.town/v/std/parseImportMeta/project";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
4import { html } from "https://esm.town/v/stevekrouse/html";
5import { renderToString } from "npm:react-dom@18.2.0/server";
6import config from "./config.json" with { type: "json" };
7import { SparklineSVG } from "./sparklineSVG";

statussparklineSVG1 match

@cameron•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
reactstream

reactstreamindex.tsx10 matches

@jxnblk•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.3.1 */
2import { hydrateRoot } from "https://esm.sh/react-dom@18.3.1/client";
3import * as React from "https://esm.sh/react@18.3.1";
4import { reactStream } from "./react-stream.tsx";
5import { parseURL } from "./parse-url.tsx";
6import { parseHeaders } from "./parse-headers.tsx";
7import { ReactStreamProps, Middleware } from "./types.tsx";
8
9export { React };
10export { robots } from "./robots.tsx";
11
12export function render<T>(
13 /** Root-level React component that renders an entire <html> element
14 * including the head and body tags.
15 */
16 Component: React.ComponentType<ReactStreamProps>,
17 /** On Val Town, use `import.meta.url` for client-side hydration */
18 module: string | false,
21) {
22 if (typeof document !== "undefined" && module) {
23 console.log("jxnblk/reactstream");
24 const props = window.__data;
25 hydrateRoot(document, <Component {...props} />);
27
28 return async function handler(request: Request): Promise<Response> {
29 const main = reactStream(Component, module);
30 const middleware: Middleware[] = [
31 parseURL,
reactstream

reactstreamtypes.tsx1 match

@jxnblk•Updated 1 month ago
6export type Middleware = (req: DataRequest, res: Response, callback: NextCallback) => Promise<Response>;
7
8export interface ReactStreamProps {
9 url: URL;
10 pathname: string;

cerebras_coderindex10 matches

@speedadd•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>

cerebras_coderindex10 matches

@jsy•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>
reactstream

reactstreamreact-stream.tsx8 matches

@jxnblk•Updated 1 month ago
1/** @jsxImportSource https://esm.sh/react@18.3.1 */
2import * as React from "https://esm.sh/react@18.3.1";
3import { ReactStreamProps, Middleware } from "./types.tsx";
4
5// main react response handler
6export const reactStream = (
7 Component: React.ComponentType<ReactStreamProps>,
8 module: string | false,
9): Middleware =>
10 async function(req: DataRequest, res: Response): Promise<Response> {
11 const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
12
13 const stream = await renderToReadableStream(
23 headers.set("Content-Type", "text/html");
24
25 console.log("reactstream", res.status);
26 return new Response(stream, {
27 headers,

project_updates_webhookindex.html1 match

@shouser•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 <link rel="stylesheet" href="/public/style.css">
8 <link

static_reactdemo.http.tsx6 matches

@jxnblk•Updated 1 month ago
1/** @jsxImportSource npm:react */
2import React from "npm:react";
3import warehouse from "./index.tsx";
4import reactRender from "./react-render.tsx";
5
6function Demo () {
8 <html>
9 <head>
10 <title>Static React Demo</title>
11 <style>{`
12 body {
20 </head>
21 <body>
22 <h1>Static React Demo</h1>
23 </body>
24 </html>
27
28export default warehouse(
29 reactRender(Demo),
30);
31

react-router-starter-remix-13 file matches

@jxnblk•Updated 8 hours ago

reactHonoStarter4 file matches

@stfnsr•Updated 1 day ago