2.0.0 • Published 4 years ago

@drawbotics/route v2.0.0

Weekly downloads
12
License
UNLICENSED
Repository
github
Last release
4 years ago

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.

2.0.0

4 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago