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=885&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 9068 results for "react"(2810ms)

buildReactMinifiedmain.tsx5 matches

@liamdanielduffy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3let { REACT_MINIFIED } = await import("https://esm.town/v/liamdanielduffy/REACT_MINIFIED");
4
5export async function buildReactMinified() {
6 let res = await fetch(
7 "https://unpkg.com/react@18/umd/react.production.min.js",
8 );
9 let src = await res.text();
10 REACT_MINIFIED = src;
11 return REACT_MINIFIED;
12}

reactTodoListWebsitemain.tsx8 matches

@root•Updated 1 year ago
1import { REACT_TODO_LIST_CONTENTS } from "https://esm.town/v/root/REACT_TODO_LIST_CONTENTS";
2import { addReactFromValCDN } from "https://esm.town/v/root/addReactFromValCDN";
3import { buildHtml } from "https://esm.town/v/root/buildHtml";
4
5// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
6export function reactTodoListWebsite(req, res) {
7 console.log(res);
8 res.set("Content-Type", "text/html");
9 res.send(buildHtml({
10 scripts: [addReactFromValCDN()],
11 styles: REACT_TODO_LIST_CONTENTS.styles,
12 body: REACT_TODO_LIST_CONTENTS.body,
13 }));
14}
15// Forked from @liamdanielduffy.reactTodoListWebsite

serveReactDemomain.tsx3 matches

@liamdanielduffy•Updated 1 year ago
1import { reactDemo } from "https://esm.town/v/liamdanielduffy/reactDemo";
2import { serveAsHTML } from "https://esm.town/v/liamdanielduffy/serveAsHTML";
3
4export function serveReactDemo(req, res) {
5 serveAsHTML(req, res, reactDemo());
6}

reactDemomain.tsx3 matches

@liamdanielduffy•Updated 1 year ago
1import { addReactFromCDN } from "https://esm.town/v/liamdanielduffy/addReactFromCDN";
2import { buildHtml } from "https://esm.town/v/liamdanielduffy/buildHtml";
3
4export function reactDemo() {
5 return buildHtml(addReactFromCDN(), "");
6}

reactSSRExamplemain.tsx9 matches

@vtdocs•Updated 1 year ago
1export const reactSSRExample = async (req: express.Request, res: express.Response) => {
2 // Import React
3 const React = await import("npm:react");
4 const ReactDOMServer = await import("npm:react-dom/server");
5 // Define some components
6 function TodoItem(props) {
7 return React.createElement("li", null, props.text);
8 }
9 function TodoList(props) {
10 const todoItems = props.items.map((item, index) =>
11 React.createElement(TodoItem, { key: index, text: item })
12 );
13 return React.createElement("ul", null, todoItems);
14 }
15 const items = ["Buy groceries", "Do laundry", "Walk the dog"];
16 // Render the page
17 const html = ReactDOMServer.renderToString(
18 React.createElement(TodoList, { items: items }),
19 );
20 res.send(html);

REACT_DOM_CDN_VALmain.tsx3 matches

@liamdanielduffy•Updated 1 year ago
1import { REACT_DOM_MINIFIED_FINAL } from "https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_FINAL";
2
3export function REACT_DOM_CDN_VAL(req, res) {
4 res.set("Content-Type", "text/javascript");
5 res.send(REACT_DOM_MINIFIED_FINAL);
6}

addReactFromValCDNmain.tsx6 matches

@liamdanielduffy•Updated 1 year ago
1import { scriptTag } from "https://esm.town/v/liamdanielduffy/scriptTag";
2
3export function addReactFromValCDN(): string {
4 const reactDom = scriptTag({
5 src: "https://api.val.town/v1/express/liamdanielduffy.REACT_DOM_CDN_VAL",
6 });
7 const react = scriptTag({
8 src: "https://api.val.town/v1/express/liamdanielduffy.REACT_CDN_VAL",
9 });
10 return [react, reactDom].join(" ");
11}

reactTodoListWebsitemain.tsx7 matches

@liamdanielduffy•Updated 1 year ago
1import { REACT_TODO_LIST_CONTENTS } from "https://esm.town/v/liamdanielduffy/REACT_TODO_LIST_CONTENTS";
2import { addReactFromValCDN } from "https://esm.town/v/liamdanielduffy/addReactFromValCDN";
3import { buildHtml } from "https://esm.town/v/liamdanielduffy/buildHtml";
4
5// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
6export function reactTodoListWebsite(req, res) {
7 res.set("Content-Type", "text/html");
8 res.send(buildHtml({
9 scripts: [addReactFromValCDN()],
10 styles: REACT_TODO_LIST_CONTENTS.styles,
11 body: REACT_TODO_LIST_CONTENTS.body,
12 }));
13}

MAXIMUM_VAL_SIZEmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
1export const MAXIMUM_VAL_SIZE = "???";
2// We ran into a bug where the entirety of React DOM minified would not fit into a val as a string. IS this a max string size? Is it a max val size? Who knows.

reactSSRExamplemain.tsx9 matches

@neverstew•Updated 1 year ago
1export const reactSSRExample = async (req: Request) => {
2 // Import React
3 const React = await import("npm:react");
4 const ReactDOMServer = await import("npm:react-dom/server");
5 // Define some components
6 function TodoItem(props) {
7 return React.createElement("li", null, props.text);
8 }
9 function TodoList(props) {
10 const todoItems = props.items.map((item, index) =>
11 React.createElement(TodoItem, { key: index, text: item })
12 );
13 return React.createElement("ul", null, todoItems);
14 }
15 const items = ["Buy groceries", "Do laundry", "Walk the dog"];
16 // Render the page
17 const html = ReactDOMServer.renderToString(
18 React.createElement(TodoList, { items: items }),
19 );
20 return new Response(html, { headers: { "Content-Type": "text/html" } });

vt-discord4 file matches

@boucher•Updated 4 days ago
Starter template with client-side React & Hono server

diceRollerUI1 file match

@dcm31•Updated 4 days ago
A web-based dice roller using React on 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