Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit af1ae57c authored by Muhammad Zaki's avatar Muhammad Zaki
Browse files

feat: added routes

parent 0f88ee59
Branches
No related tags found
No related merge requests found
@module("./logo.svg") external logo: string = "default" module Routes = {
%%raw(`import './App.css'`)
@react.component @react.component
let make = () => { let make = () => {
let (count, setCount) = React.useState(() => 0) let url = RescriptReactRouter.useUrl()
<div className="App"> switch url.path {
<header className="App-header"> | list{"users", _id} => <UserPage />
<img src={logo} className="App-logo" alt="logo" /> | list{"stories", _id} => <StoryPage />
<p> {"Hello Vite + React + ReScript!"->React.string} </p> | list{} => <StoriesPage />
<p> | _ => <div> {"Not found. Sorry."->React.string} </div>
<button onClick={_e => setCount(count => count + 1)}> }
{`count is: ${count->Belt.Int.toString}`->React.string} }
</button> }
</p>
<p> @react.component
{"Edit "->React.string} let make = () => {
<code> {"App.res"->React.string} </code> <>
{" and save to test HMR updates."->React.string} <Nav />
</p> <Routes />
<p> </>
<a
className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
{"Learn React"->React.string}
</a>
{" | "->React.string}
<a
className="App-link"
href="https://vitejs.dev/guide/features.html"
target="_blank"
rel="noopener noreferrer">
{"Vite Docs"->React.string}
</a>
{" | "->React.string}
<a
className="App-link"
href="https://rescript-lang.org/docs/react/latest/introduction"
target="_blank"
rel="noopener noreferrer">
{"ReScript Docs"->React.string}
</a>
</p>
</header>
</div>
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment