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/$%7Bsuccess?q=react&page=840&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 12990 results for "react"(3733ms)

1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React from "https://esm.sh/react@18.2.0";
3
4export function LoadingSpinner() {

email_capture_system_2Navbar.tsx2 matches

@prashamtrivedi•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React from "https://esm.sh/react@18.2.0";
3
4interface NavbarProps {

email_capture_system_2App.tsx2 matches

@prashamtrivedi•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import { Dashboard } from "./Dashboard.tsx";
4import { Navbar } from "./Navbar.tsx";

email_capture_system_2index.html6 matches

@prashamtrivedi•Updated 2 months ago
7 <script src="https://cdn.twind.style" crossorigin></script>
8 <script src="https://esm.town/v/std/catch"></script>
9 <!-- React and dependencies -->
10 <script type="module">
11 import React from "https://esm.sh/react@18.2.0";
12 import ReactDOM from "https://esm.sh/react-dom@18.2.0/client";
13 import { App } from "./components/App.tsx";
14
16 window.twind = window.twind.setup({});
17
18 // Mount React application
19 const root = ReactDOM.createRoot(document.getElementById("app"));
20 root.render(React.createElement(App));
21 </script>
22</head>

photosmain.tsx4 matches

@Learn•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { AnimatePresence, motion } from "https://esm.sh/framer-motion@10.12.7?deps=react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0,react-dom@18.2.0";
4import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
5
6function App() {

podcast_blob_adminREADME.md1 match

@toowired•Updated 2 months ago
6
7Versions 0-17 of this val were done with Hono and server-rendering.
8Versions 18+ were generated with Townie and use client-side React.
9
10To use this val, fork it to your account.

jamzmain.tsx32 matches

@all•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react */
2// Set to true to disable all editing functionality
3const READ_ONLY = true; // Keep this as is or change as needed
4
5import { nanoid } from "https://esm.sh/nanoid";
6import React from "https://esm.sh/react";
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9interface Song {
16}
17
18// --- React Components (AddSongForm, SongCard, App) ---
19// --- These remain the same as the PREVIOUS enhanced version ---
20// --- (Includes improved AddSongForm, SongCard with confirmation, App with ViewMode, etc.) ---
21
22function AddSongForm({ onAdd }: { onAdd: (song: Omit<Song, "id" | "created_at">) => void }) {
23 const [url, setUrl] = React.useState("");
24 const [title, setTitle] = React.useState("");
25 const [tag, setTag] = React.useState("");
26 const [isLoading, setIsLoading] = React.useState(false);
27 const [error, setError] = React.useState("");
28
29 const handleSubmit = async (e: React.FormEvent) => {
30 e.preventDefault();
31 setIsLoading(true);
120 },
121) {
122 const [isEditing, setIsEditing] = React.useState(false);
123 const [editUrl, setEditUrl] = React.useState(song.url);
124 const [editTitle, setEditTitle] = React.useState(song.title);
125 const [editTag, setEditTag] = React.useState(song.tag || "");
126 const [isDeleting, setIsDeleting] = React.useState(false); // For loading state during delete API call
127 const [isConfirmingDelete, setIsConfirmingDelete] = React.useState(false); // For the confirmation step
128 const [isLoading, setIsLoading] = React.useState(false); // For loading state during edit save
129 const confirmationTimer = React.useRef<number | null>(null); // Ref to hold timer ID
130
131 // Clear confirmation timer on unmount or when confirmation changes
132 React.useEffect(() => {
133 return () => {
134 if (confirmationTimer.current) {
164 };
165
166 const handleEditSubmit = async (e: React.FormEvent) => {
167 e.preventDefault();
168 setIsLoading(true); // Indicate loading for edit save
313
314function App() {
315 const [songs, setSongs] = React.useState<Song[]>([]);
316 const [sortBy, setSortBy] = React.useState<"date" | "title">("date"); // Default sort should match initial fetch if possible
317 const [selectedTag, setSelectedTag] = React.useState<string>("");
318 const [isLoading, setIsLoading] = React.useState(true);
319 const [error, setError] = React.useState("");
320 const [viewMode, setViewMode] = React.useState<"grid" | "list">("grid"); // State for view mode
321
322 // Using useCallback to stabilize the function reference
323 const fetchSongs = React.useCallback(async () => {
324 setError(""); // Clear previous errors before fetching
325 // Keep isLoading true if it was already true (initial load)
348 }, []); // Empty dependency array: function created once
349
350 React.useEffect(() => {
351 setIsLoading(true); // Set loading true when the component mounts
352 fetchSongs();
444
445 // Memoize tags derivation
446 const tags = React.useMemo(() => {
447 const tagSet = new Set<string>();
448 songs.forEach(s => {
455
456 // Memoize filtered and sorted songs
457 const filteredAndSortedSongs = React.useMemo(() => {
458 let filtered = songs;
459
621 </main>
622 <footer className="app-footer">
623 <p>© {new Date().getFullYear()} Audio Archive. Built with React & CSS.</p>
624 </footer>
625 </div>
732
733 // HTML response (SSR Shell) - Kept from enhanced version
734 // Renders the page structure, CSS, and JS includes. React hydrates on the client.
735 return new Response(
736 `

Joaldamain.tsx5 matches

@GideonEsq•Updated 2 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, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5// Vibrant color palette reflecting cultural inspiration
116 const [error, setError] = useState("");
117
118 function handleSubmit(e: React.FormEvent) {
119 e.preventDefault();
120 if (answer.trim() === "2024") {
364 });
365
366 async function handleSubmit(e: React.FormEvent) {
367 e.preventDefault();
368 setPendingAction({ type: "add", data: newProduct });

zanyBeigeFoxmain.tsx4 matches

@Nxnxnxnndnd•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { initializeApp } from "https://esm.sh/firebase/app";
3import {
9 signInWithEmailAndPassword,
10} from "https://esm.sh/firebase/auth";
11import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
12import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
13
14// Moved configuration to a more secure location
68 }, [isAuthenticated, adsLoaded]);
69
70 const handleSubmit = async (e: React.FormEvent) => {
71 e.preventDefault();
72 setIsLoading(true);

soloLikesDisplaymain.tsx3 matches

@alexwein•Updated 2 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 from "https://esm.sh/react@18.2.0";
4
5interface SoloLike {

reactHonoStarter4 file matches

@notmart•Updated 8 hours ago

FarcasterGallery10 file matches

@moe•Updated 17 hours ago
Hono + React + Tailwind + Farcaster Frame Starter Project
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