react-router4-with-layouts
TypeScript icon, indicating that this package has built-in type declarations

1.4.2 • Public • Published

react-router4-with-layouts

Allow Router to have layout prop with typescript definitions

NPM build

Install

yarn add react-router4-with-layouts

Usage more info

import React, { Component } from 'react';
import { Route } from 'react-router4-with-layouts';
import { Router, Switch } from 'react-router-dom';
import { createBrowserHistory } from 'history';

import { DefaultLayout } from './layouts/DefaultLayout';
import { HomePage } from './pages/HomePage';
import { LoginPage } from './pages/LoginPage';
import { EmptyLayout } from './layouts/EmptyLayout';

const history = createBrowserHistory();

export default class App extends Component {
  render () {
    return (
      <Router history={history}>
        <Switch>
          <Route path="/" component={HomePage} exact layout={DefaultLayout} />
          <Route path="/login" component={LoginPage} layout={EmptyLayout} />
        </Switch>
      </Router>
    );
  }
}

Todo:

  • [ ] Add tests
  • [ ] Refactor example and use StoryBook
  • [x] Add travis to publish new releases
  • [x] Add changelog

License

MIT © Vytenis Kučiauskas

NOTE Thanks to react-modern-library-boilerplate

Readme

Keywords

none

Package Sidebar

Install

npm i react-router4-with-layouts

Weekly Downloads

2

Version

1.4.2

License

MIT

Unpacked Size

18 kB

Total Files

10

Last publish

Collaborators

  • fdiskas