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=382&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 4295 results for "react"(388ms)

reactHonoStarterApp.tsx3 matches

@vawogbemi•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() {
6 return (
7 <div>
8 <h1>Val Town React + Hono Starter</h1>
9 I've been clicked <button onClick={() => setClicked((c) => c + 1)}>{clicked}</button> times
10 </div>

cerebras_coderindex10 matches

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

sdfsdfsdfsjxnReactStream16 matches

@charmaine•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";
4
5export { React };
6
7export type RequestHandler = (request: Request) => Promise<Response>;
13export type Middleware = (req: DataRequest, res: Response, callback: NextCallback) => Promise<Response>;
14
15export interface ReactStreamProps {
16 url: URL;
17 pathname: string;
23
24export function render<T>(
25 /** Root-level React component that renders an entire <html> element
26 * including the head and body tags.
27 */
28 Component: React.ComponentType<ReactStreamProps>,
29 /** On Val Town, use `import.meta.url` for client-side hydration */
30 module: string | false,
31 /** Optional middleware */
32 opts: ReactStreamOptions | Middleware[] = [],
33) {
34 const useMiddleware = Array.isArray(opts); // for backwards compat
35 const options: ReactStreamOptions = !Array.isArray(opts) ? opts : {};
36 const { api, getInitialProps } = options;
37
42
43 return async function handler(request: Request): Promise<Response> {
44 const main = reactStream(Component, module);
45 const middleware: Middleware[] = [
46 parseURL,
71export default render;
72
73// main react response handler
74const reactStream = (
75 Component: React.ComponentType<ReactStreamProps>,
76 module: string | false,
77): Middleware =>
78 async function(req: DataRequest, res: Response): Promise<Response> {
79 const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
80
81 const stream = await renderToReadableStream(
91 headers.set("Content-Type", "text/html");
92
93 console.log("react", res.status);
94 return new Response(stream, {
95 headers,
139};
140/** DEPRECATED: Use middleware instead */
141export interface ReactStreamOptions {
142 /** DEPRECATED: Optional text response for robots.txt */
143 robots?: string;

sdfsdfsdfsjxnredirects2 matches

@charmaine•Updated 1 month ago
1import { match, parse, pathToRegexp } from "https://esm.sh/path-to-regexp@7.2.0";
2import { DataRequest } from "./ReactStream";
3
4const redirects = new Map();
5redirects.set("/hello-color", "https://jxnblk.io/hello-color");
6redirects.set("/react-icons", "https://jxnblk.io/react-icons/");
7
8redirects.set("/colorable", "https://colorable.jxnblk.com");

sdfsdfsdfsjxnrss1 match

@charmaine•Updated 1 month ago
2
3// import data from "https://blog.jxnblk.com/api/all.json" with { type: "json" };
4import type { Middleware } from "https://esm.town/v/jxnblk/ReactStream";
5
6function generateRSSFeed(posts) {

sdfsdfsdfsjxndotcom4 matches

@charmaine•Updated 1 month ago
1// static / vanilla js version of jxnblkio
2/** @jsxImportSource https://esm.sh/react@18.3.1 */
3import { match } from "https://esm.sh/path-to-regexp@8.2.0";
4import React from "https://esm.sh/react@18.3.1";
5import { useMemo, useState } from "https://esm.sh/react@18.3.1";
6import { analytics } from "https://esm.town/v/jxnblk/analytics";
7import { Avatar } from "https://esm.town/v/jxnblk/avatar";
8import { App, Route } from "https://esm.town/v/jxnblk/JxnblkApp";
9import { DataRequest, render, robots } from "./ReactStream";
10import redirects from "./redirects";
11import { rss } from "./rss";

mynewprojectjxnReactStream16 matches

@charmaine•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";
4
5export { React };
6
7export type RequestHandler = (request: Request) => Promise<Response>;
13export type Middleware = (req: DataRequest, res: Response, callback: NextCallback) => Promise<Response>;
14
15export interface ReactStreamProps {
16 url: URL;
17 pathname: string;
23
24export function render<T>(
25 /** Root-level React component that renders an entire <html> element
26 * including the head and body tags.
27 */
28 Component: React.ComponentType<ReactStreamProps>,
29 /** On Val Town, use `import.meta.url` for client-side hydration */
30 module: string | false,
31 /** Optional middleware */
32 opts: ReactStreamOptions | Middleware[] = [],
33) {
34 const useMiddleware = Array.isArray(opts); // for backwards compat
35 const options: ReactStreamOptions = !Array.isArray(opts) ? opts : {};
36 const { api, getInitialProps } = options;
37
42
43 return async function handler(request: Request): Promise<Response> {
44 const main = reactStream(Component, module);
45 const middleware: Middleware[] = [
46 parseURL,
71export default render;
72
73// main react response handler
74const reactStream = (
75 Component: React.ComponentType<ReactStreamProps>,
76 module: string | false,
77): Middleware =>
78 async function(req: DataRequest, res: Response): Promise<Response> {
79 const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
80
81 const stream = await renderToReadableStream(
91 headers.set("Content-Type", "text/html");
92
93 console.log("react", res.status);
94 return new Response(stream, {
95 headers,
139};
140/** DEPRECATED: Use middleware instead */
141export interface ReactStreamOptions {
142 /** DEPRECATED: Optional text response for robots.txt */
143 robots?: string;

mynewprojectjxnredirects2 matches

@charmaine•Updated 1 month ago
1import { match, parse, pathToRegexp } from "https://esm.sh/path-to-regexp@7.2.0";
2import { DataRequest } from "./ReactStream";
3
4const redirects = new Map();
5redirects.set("/hello-color", "https://jxnblk.io/hello-color");
6redirects.set("/react-icons", "https://jxnblk.io/react-icons/");
7
8redirects.set("/colorable", "https://colorable.jxnblk.com");

mynewprojectjxnrss1 match

@charmaine•Updated 1 month ago
2
3// import data from "https://blog.jxnblk.com/api/all.json" with { type: "json" };
4import type { Middleware } from "https://esm.town/v/jxnblk/ReactStream";
5
6function generateRSSFeed(posts) {

mynewprojectjxndotcom4 matches

@charmaine•Updated 1 month ago
1// static / vanilla js version of jxnblkio
2/** @jsxImportSource https://esm.sh/react@18.3.1 */
3import { match } from "https://esm.sh/path-to-regexp@8.2.0";
4import React from "https://esm.sh/react@18.3.1";
5import { useMemo, useState } from "https://esm.sh/react@18.3.1";
6import { analytics } from "https://esm.town/v/jxnblk/analytics";
7import { Avatar } from "https://esm.town/v/jxnblk/avatar";
8import { App, Route } from "https://esm.town/v/jxnblk/JxnblkApp";
9import { DataRequest, render, robots } from "./ReactStream";
10import redirects from "./redirects";
11import { rss } from "./rss";

react-router-starter-remix-13 file matches

@jxnblk•Updated 21 hours ago

reactHonoStarter4 file matches

@stfnsr•Updated 2 days ago