Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.28 KB

File metadata and controls

49 lines (39 loc) · 1.28 KB
title app.tsx

The App component is the isomorphic (shared on server and browser) entry point into your application. This is where the code runs on both sides. This is like the classic entry point where you can define your router, and other top level components.

Basic example (with routing)

This is where routers setup navigation between the pages discovered by the FileRouter.

import { A, Router } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start/router";
import { Suspense } from "solid-js";

export default function App() {
	return (
		<Router
			root={(props) => (
					<A href="/">Index</A>
					<A href="/about">About</A>
					<Suspense>{props.children}</Suspense>
			)}
		>
			<FileRoutes />
		</Router>
	);
}

See a similar example in StackBlitz

Bare example (no routing)

Since SolidStart does not come packaged with a router, you can simply return your template of choice:

export default function App() {
	return (
		<main>
			<h1>Hello world!</h1>
		</main>
	);
}

See this example in StackBlitz