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=457&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 4680 results for "react"(535ms)

ssr_react_minimain.tsx6 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
3import { useEffect, useState } from "https://esm.sh/react@18.2.0";
4import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
5import { html } from "https://esm.town/v/stevekrouse/html";
6
7// button that's disabled until client react hydrates
8export const Button = (props) => {
9 const [clientHydrated, setClientHydrated] = useState(false);
51 const props = await loader(req);
52 const script = `
53 import { hydrateRoot } from "https://esm.sh/react-dom@18.2.0/client";
54 import { jsx as _jsx } from "https://esm.sh/react@18.2.0/jsx-runtime";
55 import { Component } from "https://esm.town/v/${author}/${name}";
56

ssr_react_mini_starterREADME.md5 matches

@stevekrouse•Updated 1 year ago
1# Starter App for [ssr_react_mini](https://www.val.town/v/stevekrouse/ssr_react_mini)
2
3You need to export four things:
4
51. `loader` - runs on any GET request, on the server. it accepts the `Request` and returns the props of your React compnent.
62. `action`- runs on the server on any non-GET, ie POST, PUT, DELETE, or `<form>`s submit
73. `Component` - your React component. it's initially server-rendered and then client-hydrated
84. `default` - you should mostly leave this line alone
9
10This is framework is bleeding-edge. You'll need to read the [code of the framework itself](https://www.val.town/v/stevekrouse/ssr_react_mini) (it's very short) to understand what it's doing.
11
12If you have questions or comments, please comment below on this val! (or any of these vals)
13
14Migrated from folder: Archive/ssr_react_mini_starter

todoListScriptmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
2import { jsx as _jsx } from "https://esm.sh/react/jsx-runtime";
3import { TodoApp } from "https://esm.town/v/stevekrouse/TodoApp";
4

ssr_react_miniREADME.md2 matches

@stevekrouse•Updated 1 year ago
1# Server-side Render React Mini Framework
2
3This is very experimental, more of a prototype of an architecture, than a true framework
5Example: https://www.val.town/v/stevekrouse/TodoApp
6
7Migrated from folder: Archive/ssr_react_mini

todo_appmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/react */
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
4import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
5import { html } from "https://esm.town/v/stevekrouse/html";

remarkmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/preact */
2import { render } from "npm:preact-render-to-string";
3
4export const remark = ({ title, content }) => async (req: Request) =>

date_me_faqmain.tsx1 match

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/preact */
2
3let linkClass = "text-sky-600 hover:text-sky-500";

reactExamplemain.tsx3 matches

@tmcw•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
3
4export const reactExample = (request: Request) =>
5 new Response(renderToString(<div>Test {1 + 1}</div>), {
6 headers: {

cors_exampleREADME.md1 match

@stevekrouse•Updated 1 year ago
10You can override them if you wish to disallow CORS.
11
12This val is a client-side-rendered React app that makes requests to @stevekrouse/cors_example_backend. The backend is in a different val because CORS applies to requests on different domains. The backend has examples of the default permissive CORS behavior and disabled CORS.
13
14Migrated from folder: Archive/cors_example

remarkDemoJSXmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/preact */
2import { render } from "npm:preact-render-to-string";
3
4export const remarkDemoJSX = async (req: Request) =>

react-router-starter-remix-13 file matches

@jxnblk•Updated 2 days ago

reactHonoStarter4 file matches

@stfnsr•Updated 3 days ago