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=303&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 9726 results for "react"(1247ms)

stevensDemoREADME.md2 matches

@jasonhwest•Updated 3 weeks ago
12## Serving assets to the frontend
13
14This backend HTTP server is responsible for serving all static assets to the browser to render the app, including HTML, JavaScript (including all client-side React), CSS, and even the favicon SVG.
15
16In a normal server environment, you would likely use a middleware [like this one](https://hono.dev/docs/getting-started/nodejs#serve-static-files) to serve static files. Some frameworks or deployment platforms automatically make any content inside a `public/` folder public.
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors

stevensDemoREADME.md1 match

@jasonhwest•Updated 3 weeks ago
8## Migrations
9
10In `backend/database/migrations.ts`, this app creates a new SQLite table `reactHonoStarter_messages` to store messages.
11
12This "migration" runs once on every app startup because it's imported in `index.ts`. You can comment this line out for a slight (30ms) performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.

stevensDemopopulateDemo.ts1 match

@jasonhwest•Updated 3 weeks ago
274 createMemory(
275 "2025-04-13",
276 "Lucas allergic to peanuts - mild reaction only, not anaphylactic.",
277 "telegram",
278 "telegram",

stevensDemoNotebookView.tsx5 matches

@jasonhwest•Updated 3 weeks ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, {
3 useState,
4 useEffect,
5 useCallback,
6 useMemo,
7} from "https://esm.sh/react@18.2.0";
8import { type Memory } from "../../shared/types.ts";
9
89 }, [fetchMemories]);
90
91 const handleAddMemory = async (e: React.FormEvent) => {
92 e.preventDefault();
93 if (!newMemoryText.trim()) return;
144 };
145
146 const handleUpdateMemory = async (e: React.FormEvent) => {
147 e.preventDefault();
148 if (!editingMemory || !editingMemory.text.trim()) return;

stevensDemoindex.tsx2 matches

@jasonhwest•Updated 3 weeks ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import { App } from "./components/App.tsx";
4

stevensDemoindex.ts1 match

@jasonhwest•Updated 3 weeks ago
1/**
2 * @jsxImportSource https://esm.sh/react@18.2.0
3 */
4import {

stevensDemohandleTelegramMessage.ts1 match

@jasonhwest•Updated 3 weeks ago
155- Current health goals and any medication reminders needed?
156
157Your goal is to collect this information naturally through conversation and store it as memories (as undated memories). Once you've gathered sufficient background information, you can conclude the intake process and transition to normal reactive chat.
158
159If the conversation is already past the intake stage, then analyze the message content and think about which memories might be worth creating based on the information provided.

stevensDemo.cursorrules9 matches

@jasonhwest•Updated 3 weeks ago
199- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
200- For persistence, use Val Town SQLite or Blob storage with `import.meta.url` for keys/table names
201- **React Configuration:** When using React libraries, pin versions with `?deps=react@18.2.0,react-dom@18.2.0` and include the `@jsxImportSource` pragma
202- When facing client-side render issues, check if all React dependencies are pinned to the same version
203- **Styling:** Default to using TailwindCSS via `<script src="https://cdn.twind.style" crossorigin></script>` unless otherwise specified
204
262
263### Frontend Best Practices
264- Structure as a standard client-side React app
265- Use SVG for favicons (Val Town only supports text files)
266- Separate components into individual files
267- Access bootstrapped data from `window.__INITIAL_DATA__`
268- Use React 18.2.0 consistently in all imports and the `@jsxImportSource` pragma
269- Follow the React component pattern from the example project
270- Handle API calls properly with proper error catching
271
289 - Always run table creation before querying
290
2913. **React Configuration:**
292 - All React dependencies must be pinned to 18.2.0
293 - Always include `@jsxImportSource https://esm.sh/react@18.2.0` at the top of React files
294 - Rendering issues often come from mismatched React versions
295
2964. **File Handling:**

stevensDemoApp.tsx5 matches

@jasonhwest•Updated 3 weeks ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, {
3 useState,
4 useEffect,
5 useCallback,
6 useMemo,
7} from "https://esm.sh/react@18.2.0";
8import { type Memory } from "../../shared/types.ts";
9import { ASSETS, SCENE_POSITIONS, SOURCE_TYPES } from "./assets.ts";
165 }, [fetchMemories]);
166
167 const handleAddMemory = async (e: React.FormEvent) => {
168 e.preventDefault();
169 if (!newMemoryText.trim()) return;
220 };
221
222 const handleUpdateMemory = async (e: React.FormEvent) => {
223 e.preventDefault();
224 if (!editingMemory || !editingMemory.text.trim()) return;

x_posts_collect_main_2main.tsx131 matches

@tsuchi_ya•Updated 3 weeks ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2// @deno-types="npm:@types/react@18.2.0"
3import React from "https://esm.sh/react@18.2.0";
4// @deno-types="npm:@types/react-dom@18.2.0/client"
5import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
6// @deno-types="npm:@clerk/types"
7import {
14 UserButton,
15 useUser,
16} from "https://esm.sh/@clerk/clerk-react@4?deps=react@18.2.0,react-dom@18.2.0";
17
18/**
25
26 // --- State declarations ---
27 const [query, setQuery] = React.useState("");
28 const [targetAccount, setTargetAccount] = React.useState("");
29 const [apiKey, setApiKey] = React.useState("");
30 const [searchType, setSearchType] = React.useState("Latest");
31 const [sinceDate, setSinceDate] = React.useState("");
32 const [untilDate, setUntilDate] = React.useState("");
33 const [desiredCount, setDesiredCount] = React.useState(40);
34 const [tweets, setTweets] = React.useState<any[]>([]);
35 const [loading, setLoading] = React.useState(false);
36 const [loadingMessage, setLoadingMessage] = React.useState("");
37 const [error, setError] = React.useState<string | null>(null);
38 const [currentSearchQuery, setCurrentSearchQuery] = React.useState("");
39 const [showAdvanced, setShowAdvanced] = React.useState(false);
40 const [savedSearches, setSavedSearches] = React.useState<any[]>([]);
41
42 const isFetchingRef = React.useRef(false);
43 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
44
45 // --- Effects ---
46 // Fetch saved searches when user signs in
47 React.useEffect(() => {
48 if (isSignedIn) {
49 fetchSavedSearches();
54
55 // --- Helper Functions ---
56 const buildQuery = React.useCallback((keywords, account, since, until) => {
57 let finalQuery = keywords.trim();
58 if (account.trim()) {
212
213 // --- Tweet Fetching Logic ---
214 const fetchAllTweets = React.useCallback(
215 async (fullQuery: string, type: string, targetCount: number) => {
216 if (!isSignedIn) {
320 );
321
322 const handleSubmit = (event: React.FormEvent) => {
323 event.preventDefault();
324 if (!isSignedIn) {
356 // --- Render Logic ---
357 if (!isLoaded) {
358 return React.createElement(
359 "div",
360 { className: "app" },
363 }
364
365 return React.createElement(
366 "div",
367 { className: "app" },
368 React.createElement("h1", { className: "title" }, "X Search"),
369 React.createElement(
370 SignedIn,
371 null,
372 React.createElement(
373 React.Fragment,
374 null,
375 React.createElement(
376 "div",
377 { className: "card user-card" },
378 React.createElement(
379 "div",
380 { className: "user-info-header" },
381 React.createElement(
382 "span",
383 { className: "welcome" },
384 `Welcome, ${user?.firstName || user?.username || "User"}`,
385 ),
386 React.createElement(UserButton, { afterSignOutUrl: "/" }),
387 ),
388 ),
389 React.createElement(
390 "div",
391 { className: "card" },
392 React.createElement(
393 "div",
394 { className: "field" },
395 React.createElement(
396 "label",
397 { htmlFor: "apiKey", className: "label" },
398 "API Key",
399 ),
400 React.createElement("input", {
401 type: "password",
402 id: "apiKey",
403 value: apiKey,
404 onChange: (e: React.ChangeEvent<HTMLInputElement>) => setApiKey(e.target.value),
405 placeholder: "Enter SocialData API Key",
406 className: "input",
408 ),
409 ),
410 React.createElement(
411 "form",
412 { onSubmit: handleSubmit, className: "card" },
413 React.createElement(
414 "div",
415 { className: "search-row" },
416 React.createElement(
417 "div",
418 { className: "field account-field" },
419 React.createElement(
420 "label",
421 { htmlFor: "targetAccount", className: "label" },
422 "Account",
423 ),
424 React.createElement(
425 "div",
426 { className: "input-wrapper" },
427 React.createElement("span", { className: "input-prefix" }, "@"),
428 React.createElement("input", {
429 type: "text",
430 id: "targetAccount",
431 value: targetAccount,
432 onChange: (e: React.ChangeEvent<HTMLInputElement>) => setTargetAccount(e.target.value),
433 placeholder: "username",
434 className: "input",
437 ),
438 ),
439 React.createElement(
440 "div",
441 { className: "field query-field" },
442 React.createElement(
443 "label",
444 { htmlFor: "queryKeywords", className: "label" },
445 "Keywords",
446 ),
447 React.createElement("input", {
448 type: "text",
449 id: "queryKeywords",
450 value: query,
451 onChange: (e: React.ChangeEvent<HTMLInputElement>) => setQuery(e.target.value),
452 placeholder: "Search terms",
453 className: "input",
456 ),
457 ),
458 React.createElement(
459 "button",
460 {
466 ),
467 showAdvanced
468 && React.createElement(
469 "div",
470 { className: "advanced-options" },
471 React.createElement(
472 "div",
473 { className: "field-row" },
474 React.createElement(
475 "div",
476 { className: "field" },
477 React.createElement(
478 "label",
479 { htmlFor: "searchType", className: "label" },
480 "Type",
481 ),
482 React.createElement(
483 "select",
484 {
485 id: "searchType",
486 value: searchType,
487 onChange: (e: React.ChangeEvent<HTMLSelectElement>) => setSearchType(e.target.value),
488 disabled: loading,
489 className: "select",
490 },
491 React.createElement(
492 "option",
493 { value: "Latest" },
494 "Latest",
495 ),
496 React.createElement("option", { value: "Top" }, "Top"),
497 ),
498 ),
499 React.createElement(
500 "div",
501 { className: "field" },
502 React.createElement(
503 "label",
504 { htmlFor: "desiredCount", className: "label" },
505 "Count",
506 ),
507 React.createElement("input", {
508 type: "number",
509 id: "desiredCount",
510 value: desiredCount,
511 onChange: (e: React.ChangeEvent<HTMLInputElement>) =>
512 setDesiredCount(
513 Math.max(1, parseInt(e.target.value, 10) || 1),
519 ),
520 ),
521 React.createElement(
522 "div",
523 { className: "field-row" },
524 React.createElement(
525 "div",
526 { className: "field" },
527 React.createElement(
528 "label",
529 { htmlFor: "sinceDate", className: "label" },
530 "Since",
531 ),
532 React.createElement("input", {
533 type: "date",
534 id: "sinceDate",
535 value: sinceDate,
536 onChange: (e: React.ChangeEvent<HTMLInputElement>) => setSinceDate(e.target.value),
537 className: "input",
538 disabled: loading,
539 }),
540 ),
541 React.createElement(
542 "div",
543 { className: "field" },
544 React.createElement(
545 "label",
546 { htmlFor: "untilDate", className: "label" },
547 "Until",
548 ),
549 React.createElement("input", {
550 type: "date",
551 id: "untilDate",
552 value: untilDate,
553 onChange: (e: React.ChangeEvent<HTMLInputElement>) => setUntilDate(e.target.value),
554 className: "input",
555 disabled: loading,
558 ),
559 ),
560 React.createElement(
561 "div",
562 { className: "button-row" },
563 !loading
564 ? React.createElement(
565 "button",
566 { type: "submit", className: "button" },
567 "Search",
568 )
569 : React.createElement(
570 "button",
571 {
577 ),
578 ),
579 React.createElement(
580 "div",
581 { className: "save-search-row" },
582 React.createElement(
583 "button",
584 {
593 ),
594 (loading || error)
595 && React.createElement(
596 "div",
597 { className: "card status-card" },
598 loading
599 && React.createElement("p", { className: "status" }, loadingMessage),
600 error && React.createElement("p", { className: "error" }, error),
601 ),
602 savedSearches.length > 0
603 && React.createElement(
604 "div",
605 { className: "card saved-searches-card" },
606 React.createElement(
607 "h2",
608 { className: "section-title" },
609 "Saved Searches",
610 ),
611 React.createElement(
612 "div",
613 { className: "saved-searches-list" },
614 savedSearches.map((search) =>
615 React.createElement(
616 "div",
617 { key: search.id, className: "saved-search-item" },
618 React.createElement(
619 "div",
620 { className: "saved-search-info" },
621 React.createElement(
622 "div",
623 { className: "saved-search-name" },
624 search.name,
625 ),
626 React.createElement(
627 "div",
628 { className: "saved-search-query" },
632 ),
633 ),
634 React.createElement(
635 "div",
636 { className: "saved-search-actions" },
637 React.createElement(
638 "button",
639 {
643 "Run",
644 ),
645 React.createElement(
646 "button",
647 {
657 ),
658 tweets.length > 0
659 && React.createElement(
660 "div",
661 { className: "card results-card" },
662 React.createElement(
663 "div",
664 { className: "results-header" },
665 React.createElement(
666 "div",
667 { className: "results-summary" },
668 React.createElement(
669 "span",
670 { className: "results-count" },
671 tweets.length,
672 ),
673 React.createElement(
674 "span",
675 { className: "results-label" },
678 ),
679 currentSearchQuery
680 && React.createElement(
681 "div",
682 { className: "query-display" },
684 ),
685 ),
686 React.createElement(
687 "div",
688 { className: "tweet-list" },
689 tweets.map((tweet) =>
690 React.createElement(
691 "div",
692 { key: tweet.id_str, className: "tweet" },
693 React.createElement(
694 "div",
695 { className: "tweet-header" },
696 React.createElement("img", {
697 src: tweet.user.profile_image_url_https,
698 alt: `${tweet.user.name}'s profile`,
699 className: "avatar",
700 }),
701 React.createElement(
702 "div",
703 { className: "user-info" },
704 React.createElement(
705 "div",
706 { className: "name-row" },
707 React.createElement(
708 "span",
709 { className: "name" },
710 tweet.user.name,
711 ),
712 React.createElement(
713 "span",
714 { className: "username" },
716 ),
717 ),
718 React.createElement(
719 "div",
720 { className: "date" },
726 ),
727 ),
728 React.createElement(
729 "p",
730 { className: "tweet-text" },
732 ),
733 tweet.entities?.media?.length > 0
734 && React.createElement(
735 "div",
736 { className: "media-container" },
737 tweet.entities.media.map((mediaItem: any) =>
738 React.createElement(
739 "div",
740 { key: mediaItem.id_str, className: "media-item" },
741 mediaItem.type === "photo"
742 || mediaItem.type === "animated_gif"
743 ? React.createElement(
744 "a",
745 {
748 rel: "noopener noreferrer",
749 },
750 React.createElement("img", {
751 src: mediaItem.media_url_https,
752 alt: `Media`,
756 )
757 : mediaItem.type === "video"
758 ? React.createElement(
759 "a",
760 {
764 className: "video-link",
765 },
766 React.createElement("img", {
767 src: mediaItem.media_url_https,
768 alt: `Video preview`,
770 className: "media",
771 }),
772 React.createElement(
773 "div",
774 { className: "play-icon" },
780 ),
781 ),
782 React.createElement(
783 "div",
784 { className: "tweet-footer" },
785 React.createElement(
786 "div",
787 { className: "metrics" },
788 React.createElement(
789 "span",
790 { className: "metric" },
792 tweet.favorite_count ?? 0,
793 ),
794 React.createElement(
795 "span",
796 { className: "metric" },
798 tweet.retweet_count ?? 0,
799 ),
800 React.createElement(
801 "span",
802 { className: "metric" },
805 ),
806 ),
807 React.createElement(
808 "a",
809 {
824 && currentSearchQuery
825 && !error
826 && React.createElement(
827 "div",
828 { className: "card empty-card" },
829 "No tweets found",
830 ),
831 React.createElement(
832 "footer",
833 null,
834 "Powered by ",
835 React.createElement(
836 "a",
837 {
843 ),
844 " | ",
845 React.createElement(
846 "a",
847 { href: sourceUrl, target: "_top" },
851 ),
852 ),
853 React.createElement(
854 SignedOut,
855 null,
856 React.createElement(
857 "div",
858 { className: "clerk-auth-container" },
859 React.createElement(SignIn, {
860 path: "/sign-in",
861 routing: "path",
862 signUpUrl: "/sign-up",
863 }),
864 React.createElement(SignUp, {
865 path: "/sign-up",
866 routing: "path",
891 if (root) {
892 createRoot(root).render(
893 React.createElement(
894 ClerkProvider,
895 { publishableKey: publishableKey },
896 React.createElement(App),
897 ),
898 );

StarterPackFeeds10 file matches

@moe•Updated 12 hours ago
Hono + React + Tailwind + Farcaster Mini App Starter Project

reactHonoStarter4 file matches

@deboneil07•Updated 12 hours ago
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