Public
Readme
The router map url paths to component vals.
Component vals must export a React Component as their default export:
Optionally, you can define an handler next to your component, allowing you to handle query params or form inputs.
Use the ctx.render
function to pass props to your component.
export const handler: Handler = (ctx) => {
const url = new URL(ctx.req.url);
const params = new URLSearchParams(url.search);
return ctx.render({ name: params.get("name") });
};
export default function(props: {name?: string}) {
<h1>Hello { name || "World }!</h1>
}
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Comments
Nobody has commented on this val yet: be the first!
pomdtr-ssr_router.web.val.run
Updated: February 26, 2024