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/image-url.jpg%20%22Image%20title%22?q=react&page=12&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 21585 results for "react"(1741ms)

eventsCalendarAGENTS.md6 matches

@roopโ€ขUpdated 4 days ago
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
191- **React Configuration:** When using React libraries, pin versions with `?deps=react@18.2.0,react-dom@18.2.0` and start the file with `/** @jsxImportSource https://esm.sh/react@18.2.0 */`
192- Ensure all React dependencies and sub-dependencies are pinned to the same version
193- **Styling:** Default to using TailwindCSS via `<script src="https://cdn.twind.style" crossorigin></script>` unless otherwise specified
194
275 - Always run table creation before querying
276
2773. **React Configuration:**
278 - All React dependencies must be pinned to 18.2.0
279 - Always include `@jsxImportSource https://esm.sh/react@18.2.0` at the top of React files
280 - Rendering issues often come from mismatched React versions
281
2824. **File Handling:**
69
70### HTML Content Handling
71When serving the React frontend, initial data is injected into the HTML to avoid loading states. To prevent HTML content from Notion pages (like `<script>` tags or other HTML elements) from breaking the JavaScript bootstrapping process, all `<` characters in the JSON data are escaped using Unicode escape sequences (`\u003c`). This ensures that any HTML tags in Notion content are safely rendered as text rather than executed as HTML.
72
73## Usage
12 const id = c.req.param("id");
13
14 // Always serve React frontend for glimpse routes
15 try {
16 let html = await readFile("/frontend/glimpse.html", import.meta.url);
23
24 // Inject initial data into HTML - escape < characters to prevent HTML injection
25 // from Notion content breaking the JavaScript when bootstrapping React
26 const dataScript = `<script>
27 window.__GLIMPSE_DATA__ = ${JSON.stringify(result).replace(/</g, "\\u003c")};
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useEffect } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3
4// TypeScript declaration for Prism global
21 </h1>
22 <div id="header-right" class="flex items-center gap-3">
23 <!-- Dynamic content will be populated here by React -->
24 </div>
25 </div>
1# Frontend Architecture
2
3This directory contains the frontend application with a clean, scalable architecture following React best practices and separation of concerns.
4
5## Directory Structure
7```
8frontend/
9โ”œโ”€โ”€ components/ # React components (UI rendering only)
10โ”‚ โ”œโ”€โ”€ GlimpseView.tsx # Main glimpse viewing component
11โ”‚ โ”œโ”€โ”€ NotionBlock.tsx # Notion block rendering with semantic HTML
12โ”‚ โ””โ”€โ”€ NotionProperty.tsx # Notion property rendering with type-specific formatting
13โ”œโ”€โ”€ hooks/ # Custom React hooks (stateful logic)
14โ”‚ โ”œโ”€โ”€ useAuth.ts # Authentication and authorization
15โ”‚ โ”œโ”€โ”€ useGlimpseData.ts # Glimpse data fetching and state
33โ”‚ โ””โ”€โ”€ notion-content.css # Notion-specific styling
34โ”œโ”€โ”€ pages/ # Page entry points
35โ”‚ โ””โ”€โ”€ glimpse.tsx # Glimpse page React entry point
36โ””โ”€โ”€ *.html # HTML templates with semantic structure
37```
48### **Data Flow**
49```
50HTML Template โ†’ React Entry Point โ†’ Components โ†’ Hooks โ†’ Services โ†’ Utils
51 โ†“ โ†“ โ†“ โ†“ โ†“
52 DOM Mount UI Rendering State API Calls Pure Logic
703. **HTML template** served with semantic structure (header/main/footer)
714. **Initial data injection** - glimpse data embedded in `window.__GLIMPSE_DATA__`
725. **React entry point** (`glimpse.tsx`) mounts to `#root`
73
74#### **React Initialization**
751. **`glimpse.tsx`** extracts initial data from window
762. **`GlimpseView`** component renders with initial data
83- **Orchestrates** all data and UI logic
84- **Uses custom hooks** for all stateful operations
85- **Renders header content** via React portals to HTML header
86- **Conditionally shows** agent connection UI and page content
87- **Handles loading/error states** with user-friendly UI
175### **Technical Features**
176- **Server-side data injection** - eliminates loading states
177- **React portals** - dynamic header content population
178- **Automatic polling** - real-time agent data updates
179- **Smart error handling** - graceful degradation
259### **Adding New Pages**
2601. **Create HTML template** with same header/footer structure
2612. **Create React entry point** following glimpse.tsx pattern
2623. **Reuse existing hooks** for common functionality
2634. **Add page-specific components** as needed
2731. **Utils** - Unit test pure functions
2742. **Services** - Mock API responses
2753. **Hooks** - Test with React Testing Library
2764. **Components** - Test rendering with mocked dependencies
277
278This architecture provides a solid foundation for building scalable, maintainable React applications with clear separation of concerns and excellent developer experience.
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import { extractPlainText, formatNotionDate, formatMultiSelect, formatBoolean } from "../utils/notionFormatting.ts";
4
3 */
4
5import { useEffect, useRef } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
6import { updateViewingStatus } from "../services/viewingService.ts";
7
3 */
4
5import { useState, useEffect } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
6import { fetchGlimpseData } from "../services/glimpseService.ts";
7import type { UseGlimpseDataReturn } from "../types/hooks.ts";
3 */
4
5import { useMemo } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
6import { getUserEmailFromWindow, checkAuthorization } from "../utils/validation.ts";
7import type { UseAuthReturn } from "../types/hooks.ts";

glimpse2-runbook-view-glimpse-save-login-react19 file matches

@lightweightโ€ขUpdated 2 hours ago

wa-hono-react4 file matches

@nbbaierโ€ขUpdated 1 day ago
react
franky47
Freelance software engineer, open-sourcerer, speaker. Building `nuqs`, a type-safe search params state manager for React.