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=460&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 4697 results for "react"(364ms)

preactExamplemain.tsx3 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/preact */
2import { render } from "npm:preact-render-to-string";
3
4export const preactExample = () =>
5 new Response(render(<div>Test {1 + 1}</div>), {
6 headers: {

preactExampleREADME.md1 match

@stevekrouse•Updated 1 year ago
1Migrated from folder: Archive/docsExamples/jsx/preactExample

preactmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { html } from "https://esm.town/v/stevekrouse/html";
2import { render } from "npm:preact-render-to-string";
3
4export let preact = jsx => html(render(jsx));

preactREADME.md1 match

@stevekrouse•Updated 1 year ago
1Migrated from folder: Archive/docsExamples/scriptTag/preact

someDommain.tsx2 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/preact */
2import { render } from "npm:preact-render-to-string";
3
4const x = 1;

preactTestmain.tsx2 matches

@tmcw•Updated 1 year ago
1export const preactTest = (async () => {
2 const { useState, h, htm, renderToString } = await import(
3 "https://npm.reversehttp.com/preact,htm,preact/hooks,preact-render-to-string"
4 );
5 const html = htm.bind(h);

mtmain.tsx1 match

@stevekrouse•Updated 1 year ago
42
43 const onCancel = function (event) {
44 // handle cancel event (e.g. email the user later to try and reactivate them)
45 // note: this event will not be triggered if the user closes their browser.
46 };

litExampleREADME.md1 match

@tmcw•Updated 1 year ago
1# lit
2
3[Lit](https://lit.dev/docs/ssr/server-usage/) is kind of like Google's answer to React: it's a little more reliant on browser APIs like custom elements and the shadow DOM, a little less 'magic', like using JSX.
4
5This is an example of using Lit and rendering it straight to a string, which is something that's recently popular. It works pretty well, right off the bat: Lit provides nice ESM modules and a pretty smooth workflow!

sparklineEx2README.md1 match

@stevekrouse•Updated 1 year ago
11```
12
13Contrast with [@stevekrouse.sparklineEx](/v/@stevekrouse.sparklineEx) which uses react-sparklines.
14
15Migrated from folder: utils/sparklines/sparklineEx2

sparklineExREADME.md2 matches

@stevekrouse•Updated 1 year ago
1# Server-Rendered React Sparkline Example
2
3Vaguely inspired by [Easy SVG sparklines](https://alexplescan.com/posts/2023/07/08/easy-svg-sparklines/), but totally different because that had zero dependencies and this has all the dependencies: react, htm, react-sparklines.
4
5This is the live-generated SVG that this very val generates:

reactHonoStarter4 file matches

@bradnoble•Updated 27 mins ago

react-router-starter-remix-13 file matches

@jxnblk•Updated 2 days ago