This template is intended to be used with the tutorial "Solid JS - Basic Routing". http://carlbecker.dev/...
This is a template for a tutorial and is customized to that purpose. It is not intended nor appropriate as a starting point live for a real-life production project.
dgit pnpm dev
- Start with the official Solid JavaScript template
npx degit solidjs/templates/js solid-routing-basic
- Delete these files
- src/logo.svg
- src/App.module.css
- Install Bootstrap
pnpm i bootstrap
- Replace the code in index.css with this:
.app {
padding: 15px;
}
.home {
margin-left: 15px;
}
.card {
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 15px;
margin-bottom: 15px;
}
- Replace the code in App.jsx with this:
export default function App() {
return (
<div class="container" style="padding: 15px">
<div class="card">
<h1>App</h1>
</div>
</div>
);
}
- Replace the code in
index.jsx
with this:
/* @refresh reload */
import { render } from 'solid-js/web';
import App from './App';
import 'bootstrap/dist/css/bootstrap.min.css'
const root = document.getElementById('root');
render(() => <App />, root);
-
Create a folder under source named "pages"
-
Create
Home.jsx
export default function Home() {
return (
<div class="card child">
<h1>Home</h1>
</div>
);
}
- Create
NotFound.jsx
export default function NotFound() {
return (
<div class="card child">
<h1>NotFound</h1>
</div>
);
}
- Create
User.jsx
export default function User() {
return (
<div class="card child">
<h1>User</h1>
</div>
);
}
That's all you need to do. You are ready to start the [link NOT PUBLISHED YET link] tutorial.