React Router

Dart bindings for react-router. Based off of the comment on this issue

Note: Bindings are incomplete with full react-router, happy to accept prs or issues to add missing implementations

Includes implementations for both react-dart and over_react:

import 'package:react_router/react_dart.dart'; // react_dart bindings
import 'package:react_router/over_react.dart'; // over_react bindings

Installing

Add the following to your pubspec:

dependencies:
  react_router:
    git:
      url: git@github.com:matthewnitschke/react_router_dart.git
      ref: master      

Add the js library for react_router to your html file:

<script src="packages/react_router/react_router.js"></script>

Implement the router in your app

import 'packages:react_router/over_react.dart';

void main() {
  render(
    Router()(
      Switch()(
        (Route()
          ..path = 'login'
        )(
          Login()()
        )
      ),
      Switch()(
        (Route()
          ..path = '/'
          ..exact = true
        )(
          Home()()
        )
      )
    )
    querySelector('#root');
  )
}

When running, make sure to use webdev_proxy

Libraries

over_react
Bindings to use when directly consuming the over_react library
react_dart
Bindings to use when directly consuming the react_dart library
route
route.over_react.g
router
router.over_react.g
switch
switch.over_react.g
wrapper