@drawbotics/route

The main difference this route object has compared to [Route](https://reacttraining.com/react-router/web/api/Route) is that it accepts two extra props: `withProps` and `basePath`.

Stats

StarsIssuesVersionUpdatedCreatedSize
@drawbotics/route
2.0.02 years ago3 years agoMinified + gzip package size for @drawbotics/route in KB

Readme

Route

The main difference this route object has compared to Route is that it accepts two extra props: withProps and basePath.

  • withProps: An object containing extra props to be passed to the rendered route component.
  • basePath: Indicate to the rendered route and the children routes what's the base path of the parent.

Usage

An usage example:

import React from 'react';
import { Route } from '@drawbotics/route';

import MyRouteComponent from '../routes/MyRouteComponent';


class MyComponent extends React.Component {
  render() {
    return (
      <Route
        basePath="/parent-url"
        path="/some-url"
        withProps={{ title: 'The Title', items: [ /* ... */ ]
        component={MyRouteComponent} />
    );
  }
}

Extra

A Switch component with support for basePath is also included. It's used exactly the same way as vanilla Switch from react-router.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.