newjxnReactStream0 matches
1export default async function(req: Request): Promise<Response> {
2const url = new URL(req.url);
3return fetch(new URL(url.pathname + url.search, "https://charmaine--c805d178-05c3-11f0-a611-569c3dd06744.web.val.run/"), {
4method: req.method,
5headers: req.headers,
newnewTestVal3 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
transcendentCoralOrangutanmain.tsx6 matches
1// /** @jsxImportSource https://esm.sh/react@18.2.0 */
2// import React from "https://esm.sh/react@18.2.0";
3// import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4// import { type router } from "https://esm.town/v/charmaine/fetsServerExample";
5// import { createClient } from "https://esm.sh/fets@0.7.0";
1011// function App() {
12// const [greetings, setGreetings] = React.useState<string[]>([]);
13// const [error, setError] = React.useState<string | null>(null);
1415// React.useEffect(() => {
16// fetchGreetings();
17// }, []);
needsMoreMagicmain.tsx3 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useRef, useEffect } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import JsBarcode from "https://esm.sh/jsbarcode@3.11.0";
3import JSZip from "https://esm.sh/jszip@3.10.1";
4import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
5import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
67function generateEAN13WithCheckDigit() {
sdfasdfdsanewTestVal3 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
8- [charmaine/rss](https://www.val.town/v/charmaine/rss)
9- [charmaine/redirects](https://www.val.town/v/charmaine/redirects)
10- [charmaine/ReactStream](https://www.val.town/v/charmaine/ReactStream)
1112
jxnReactStream16 matches
1/** @jsxImportSource https://esm.sh/react@18.3.1 */
2import { hydrateRoot } from "https://esm.sh/react-dom@18.3.1/client";
3import * as React from "https://esm.sh/react@18.3.1";
45export { React };
67export type RequestHandler = (request: Request) => Promise<Response>;
13export type Middleware = (req: DataRequest, res: Response, callback: NextCallback) => Promise<Response>;
1415export interface ReactStreamProps {
16url: URL;
17pathname: string;
2324export function render<T>(
25/** Root-level React component that renders an entire <html> element
26* including the head and body tags.
27*/
28Component: React.ComponentType<ReactStreamProps>,
29/** On Val Town, use `import.meta.url` for client-side hydration */
30module: string | false,
31/** Optional middleware */
32opts: ReactStreamOptions | Middleware[] = [],
33) {
34const useMiddleware = Array.isArray(opts); // for backwards compat
35const options: ReactStreamOptions = !Array.isArray(opts) ? opts : {};
36const { api, getInitialProps } = options;
374243return async function handler(request: Request): Promise<Response> {
44const main = reactStream(Component, module);
45const middleware: Middleware[] = [
46parseURL,
71export default render;
7273// main react response handler
74const reactStream = (
75Component: React.ComponentType<ReactStreamProps>,
76module: string | false,
77): Middleware =>
78async function(req: DataRequest, res: Response): Promise<Response> {
79const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
8081const stream = await renderToReadableStream(
91headers.set("Content-Type", "text/html");
9293console.log("react", res.status);
94return new Response(stream, {
95headers,
139};
140/** DEPRECATED: Use middleware instead */
141export interface ReactStreamOptions {
142/** DEPRECATED: Optional text response for robots.txt */
143robots?: string;
1import { match, parse, pathToRegexp } from "https://esm.sh/path-to-regexp@7.2.0";
2import { DataRequest } from "./ReactStream";
34const redirects = new Map();
5redirects.set("/hello-color", "https://jxnblk.io/hello-color");
6redirects.set("/react-icons", "https://jxnblk.io/react-icons/");
78redirects.set("/colorable", "https://colorable.jxnblk.com");