react_router 1.0.0 copy "react_router: ^1.0.0" to clipboard
react_router: ^1.0.0 copied to clipboard

dart bindings for react_router

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

1
likes
5
pub points
0%
popularity

Publisher

unverified uploader

dart bindings for react_router

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

js, over_react, react

More

Packages that depend on react_router