Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* @title Running React on the Client
* @description Vals can also be used to host client-side code!
* @preview https://pomdtr-react_example_server.web.val.run
* @include pomdtr/react_example_client
* @resource [React - Quick Start](https://react.dev/learn)
*/
// The server response includes a script referencing the client val
export const server = (req) =>
new Response(
`<html>
<head>
<title>React Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<main id="root"></main>
<script type="module" src="https://esm.town/v/pomdtr/react_example_client"></script/>
</body>
</html>`,
{
headers: {
"Content-Type": "text/html",
},
},
);
pomdtr-react_example.web.val.run
April 10, 2024