# Router
# Installation
To install the EllJo Router you need to add a package.
# Npm
npm install @elljo/router
# Yarn
yarn add @elljo/router
# Usage
First you need to create an array of routes. Every route has a path and a component that should be displayed on this route.
const routes = [
{
url: '/',
component: Index
},
{
url: '/hello',
component: Hello
}
]
You need to create a router instance with this array.
import Router from 'elljo-router'
const router = new Router(routes)
The last step is to tell EllJo to use the router. For this you can add the router as a plugin.
const ellJo = new EllJo();
ellJo.addPlugin(router)
Now you can use the globally registered Router component to specify where the router should render the pages.
<Router></Router>