Search

1,917 code results for react client side

Code
1,917

/** @jsxImportSource https://esm.sh/react@18.2.0 **/
// Make sure to only import from esm.sh (npm: specifier are not supported in the browser)
import ReactDOM from "https://esm.sh/react-dom@18.2.0";
import React from "https://esm.sh/react@18.2.0";
import { useState } from "https://esm.sh/react@18.2.0";
import { Tldraw } from "https://esm.sh/tldraw@2.1.0";
// The app will be rendered inside the root div
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
/** @jsxImportSource https://esm.sh/react **/
// Make sure to only import from esm.sh (npm: specifier are not supported in the browser)
import ReactDOM from "https://esm.sh/react-dom";
import React, { useState, useEffect } from "https://esm.sh/react@18.0.0";
// The app will be rendered inside the root div
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
/**
* @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) =>
<head>
<title>TLDraw React Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"
<main id="root"></main>
<script type="module" src="https://esm.town/v/iamseeley/reacttldrawclient"></script>
</body>
/**
* @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) =>
<head>
<title>TLDraw React Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"
<main id="root"></main>
<script type="module" src="https://esm.town/v/tfayyaz/reacttldrawclient"></script/>
</body>
try doing the form as a GET request, manual JS script, or client side react)
- [ ] make the timezone picker better (fewer options, searchable)
Migrated from folder: Archive/cron_client_react_fork
This val is a client-side-rendered React app that makes requests to @stevekrouse/cors_example_ba
/**
* @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) =>
<head>
<title>React Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<main id="root"></main>
<script type="module" src="https://esm.town/v/andreterron/react_tldraw_client"></script/>
</body>
// JSX can be used in the client val thanks to this magic comment
/** @jsxImportSource https://esm.sh/react **/
// Make sure to only import from esm.sh (npm: specifier are not supported in the browser)
import React from "https://esm.sh/react";
import ReactDOM from "https://esm.sh/react-dom";
import { Tldraw } from "https://esm.sh/tldraw";
// The app will be rendered inside the root div
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
# SSR React Mini & SQLite Todo App
This Todo App is server rendered *and* client-hydrated React. This architecture is a lightweight
## SSR React Mini Framework
This ["framework"](https://www.val.town/v/stevekrouse/ssr_react_mini) is currently 44 lines of c
The trick is [client-side importing](https://www.val.town/v/stevekrouse/ssr_react_mini?v=53#L30)
t is making sure that server-only code doesn't run on the client and vice-versa. For example, be
# SSR React Mini & SQLite Todo App
This Todo App is server rendered *and* client-hydrated React. This architecture is a lightweight
## SSR React Mini Framework
This ["framework"](https://www.val.town/v/stevekrouse/ssr_react_mini) is currently 44 lines of c
The trick is [client-side importing](https://www.val.town/v/stevekrouse/ssr_react_mini?v=53#L30)
t is making sure that server-only code doesn't run on the client and vice-versa. For example, be
// render WebcamPage as a client side react component with fetch handler response object
import WebcamPage from 'https://esm.sh/gh/fal-ai/fal-js@9cc7cf5456/apps/demo-nextjs-app-router/a
import React from 'https://esm.sh/react@17.0.2?dev';
import { render } from 'https://esm.sh/react-dom@17.0.2?dev';
render(React.createElement(WebcamPage), document.getElementById('root'));
`;
# Example Full-stack Todo List App with React SSR + Client-side hydration & sqlite
Requires you to put the React component in another val, in this case: https://www.val.town/v/st