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/$%7Burl%7D?q=react&page=1409&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 16019 results for "react"(1281ms)

TaskManagerAppmain.tsx4 matches

@arfanUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import {
3 AlertCircle,
11 Trash,
12 XCircle,
13} from "https://esm.sh/lucide-react?deps=react@18.2.0";
14import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0,react-dom@18.2.0";
15import React, { ChangeEvent, useCallback, useEffect, useState } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
16
17/** Represents a task item in the task manager. */

billiardCafeAppmain.tsx10 matches

@KpoolUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useCallback, useEffect, useMemo, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function GameChallenge({ user, onGameEnd }) {
352 {
353 "imports": {
354 "react": "https://esm.sh/react@18.2.0",
355 "react-dom": "https://esm.sh/react-dom@18.2.0",
356 "react-dom/client": "https://esm.sh/react-dom@18.2.0/client"
357 }
358 }
366 <script src="https://esm.town/v/std/catch"></script>
367 <script type="module">
368 import React from 'react';
369 import { createRoot } from 'react-dom/client';
370
371 const App = () => {
372 const [username, setUsername] = React.useState('');
373 const [error, setError] = React.useState('');
374
375 const handleLogin = async (e) => {

lhcmain.tsx3 matches

@vawogbemiUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
3import React, { useState } from "https://esm.sh/react@18.2.0";
4import { email } from "https://esm.town/v/std/email";
5import { OpenAI } from "https://esm.town/v/std/openai";

musicalPeachCatfishmain.tsx3 matches

@alexweinUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import { boggleSolver } from "https://esm.town/v/alexwein/boggleSolverTownie";
5import { getRandomWord } from "https://esm.town/v/alexwein/getRandomWord";

zanyOrangeCowmain.tsx2 matches

@mrrihanmeerUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 **/
2import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
3
4export default (req: Request) => {

notedCoffeeSpidermain.tsx2 matches

@RaazxUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 **/
2import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
3
4export default (req: Request) => {

instagramAnalyzeUnfollowersmain.tsx3 matches

@nuloUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react */
2import JSZip from "https://esm.sh/jszip@3.10.1";
3import React, { useState } from "https://esm.sh/react";
4import { createRoot } from "https://esm.sh/react-dom/client"; //
5
6function App() {

cerebras_codermain.tsx10 matches

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

inventorymain.tsx11 matches

@toowiredUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5const techOptions = {
6 frontend: [
7 { name: "React", icon: "⚛️", explanation: "A popular JavaScript library for building user interfaces", complexity: 3 },
8 { name: "Vue", icon: "🖖", explanation: "A progressive framework for building user interfaces", complexity: 2 },
9 { name: "Angular", icon: "🅰️", explanation: "A platform for building web applications", complexity: 4 },
10 { name: "Svelte", icon: "🔥", explanation: "A radical new approach to building user interfaces", complexity: 2 },
11 { name: "Next.js", icon: "⏭️", explanation: "A React framework with hybrid static & server rendering", complexity: 3 },
12 { name: "Tailwind CSS", icon: "🎨", explanation: "A utility-first CSS framework for rapid UI development", complexity: 2 },
13 ],
38function client() {
39 const root = document.getElementById("root");
40 if (root && typeof React !== 'undefined' && React.useState) {
41 const { useState, useEffect, useRef } = React;
42
43 function App() {
252 try {
253 createRoot(root).render(
254 <React.StrictMode>
255 <App />
256 </React.StrictMode>
257 );
258 } catch (error) {
259 console.error("Error rendering React app:", error);
260 root.innerHTML = `<div style="color: red; padding: 20px;">
261 <h2>Error Rendering App</h2>
265 }
266 } else {
267 console.error("Root element not found or React is not properly loaded");
268 }
269}

ReactStaticmain.tsx13 matches

@jxnblkUpdated 4 months ago
1/** @jsxImportSource https://esm.sh/react@18.3.1 */
2// import { 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,
38
39 return async function handler(request: Request): Promise<Response> {
40 const main = reactRender(Component);
41 const middleware: Middleware[] = [
42 parseURL,
62export default render;
63
64// main react response handler
65const reactRender = (
66 Component: React.ComponentType<ReactStreamProps>,
67): Middleware =>
68 async function(req: DataRequest, res: Response): Promise<Response> {
69 const { renderToStaticMarkup } = await import("https://esm.sh/react-dom@18.3.1/server");
70
71 const html = await renderToStaticMarkup(<Component {...req.data} />);
84 headers.set("Content-Type", "text/html");
85
86 console.log("react", res.status);
87 return new Response(html, {
88 headers,

MiniAppStarter10 file matches

@moeUpdated 9 hours ago
Hono + React + Tailwind + Farcaster Mini App Starter Project
hanabi

hanabi3 file matches

@jxnblkUpdated 12 hours ago
React Router for Hono in Val Town
effector
Write business logic with ease Meet the new standard for modern TypeScript development. Type-safe, reactive, framework-agnostic library to manage your business logic.
officialrajdeepsingh
Follow me if you learn more about JavaScript | TypeScript | React.js | Next.js | Linux | NixOS | Frontend Developer | https://linktr.ee/officialrajdeepsingh