This is not an official Glimmer.js repo, it's the work of jkarsrud
glimmer-router
is a declarative router for Glimmer.js, heavily inspired by react-router
. The philosophy is explained so well in React Router's documentation that I don't see why I should need to re-write everything here. If you're interested, head on over there!
By using the <g-route>
component, we can declare what we want to render when the route matches:
In addition to this, the <Route>
component yields a Match
object:
interface Match {
path: string,
url: string,
params: any,
isExact: boolean
}
This allows you to pass information about the rendered route into sub content or child components:
The benefit of having a component like <g-route>
that can render content based on the URL, is that you can render content in different locations based on the same URL. This comes in handy when you want to render some route-specific content in ie. a sidebar:
This repo's issues is more or less updated with what needs to be done.
The main thing that needs to be solved right now is how do handle dynamic segments/route-params. This will allow you to pass that data to the child components:
You will need the following things properly installed on your computer.
git clone <repository-url>
this repositorycd glimmer-router
yarn
ember serve
- Visit your app at http://localhost:4200.
ember build
(development)ember build --environment production
(production)