Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChangJoo-Park/006496276f164e1b0f61e10e2c37f6a8 to your computer and use it in GitHub Desktop.
Save ChangJoo-Park/006496276f164e1b0f61e10e2c37f6a8 to your computer and use it in GitHub Desktop.
Rescript react hashmode routing
@module("./logo.svg") external logo: string = "default"
%%raw(`import './App.css';`)
@react.component
let make = () => {
let url = RescriptReactRouter.useUrl()
switch url.hash {
| "" => <Home />
| "about" => <About />
| "contact" => <Contact />
| _ => <NotFound />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment