npm install
<body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> <script src="/src/index.tsx" type="module"></script> </body>
<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" /> <title>Solid App</title> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> <script src="/src/index.tsx" type="module"></script> </body></html>
const Root= (props) => ( <> {props.children} </>);render(() => ( // <Home/> <Router root={Root}> <Route path={"/"} component={Home} /> </Router> ), document.getElementById("app"));
<Route path={"/"} component={Home}></Route>
<Route path={"/"} component={Home} />
import {render} from "solid-js/web";import {Route, Router} from "@solidjs/router";import Home from "./Home"; // if Home.tsx is in same directory as indexrender(() => ( <Router> <Route path="/home" component={Home}/> </Router> ), document.getElementById("app"));
return <Show when={!isLoading()}>{props.children}</Show>;
const resolved = children(() => !isLoading() && props.children);return <>{resolved()}</>;