createRouter function

Create your router instance using the createRouter function passing an array of routes and an element selector as the router outlet:

// import the function
import { createRouter } from 'https://cdn.skypack.dev/@ficusjs/router@3'

// create list of routes
const routes = [
  // routes defined here
]

const router = createRouter(routes, '#router-outlet')

When using the createRouter function, the following arguments can be passed:

ArgumentTypeRequiredDescription
routesArrayyesAn array of routes
rootOutletSelectorStringyesA CSS selector for the main router outlet
optionsObjectAn optional set of options. See options