diff --git a/examples/index.html b/examples/index.html index 2b7bc75cb6..163b1a3812 100644 --- a/examples/index.html +++ b/examples/index.html @@ -12,6 +12,7 @@

React Router Examples

  • Master Detail
  • Partial App Loading
  • Query Params
  • +
  • Reactive Extensions
  • Shared Root
  • Sidebar
  • Simple Master Detail
  • diff --git a/examples/rx/app.js b/examples/rx/app.js new file mode 100644 index 0000000000..1e2a70d95c --- /dev/null +++ b/examples/rx/app.js @@ -0,0 +1,46 @@ +var React = require('react'); +var Router = require('react-router'); +var { Route, Redirect, RouteHandler, Link } = Router; +var Rx = require('rx'); + +var App = React.createClass({ + render () { + return ( +
    + + +
    + ); + } +}); + +var User = React.createClass({ + mixins: [ Router.State ], + + render () { + var { userId } = this.getParams(); + return ( +
    +

    User id: {userId}

    +
    + ); + } +}); + +var routes = ( + + + +); + +var source = Rx.Observable.fromEventPattern(function(h) { + Router.run(routes, h); +}); + +source.subscribe(function (Handler) { + React.render(, document.getElementById('example')) +}); + diff --git a/examples/rx/index.html b/examples/rx/index.html new file mode 100644 index 0000000000..049a083ece --- /dev/null +++ b/examples/rx/index.html @@ -0,0 +1,9 @@ + +Reactive Extenstions Example + + +

    React Router Examples / Reactive Extensions

    +
    + + + diff --git a/package.json b/package.json index 55c3a9a4cb..d39614566e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "browserify-shim": "3.6.0", "bundle-loader": "0.5.1", "envify": "1.2.0", + "events": "1.0.2", "expect": "0.1.1", "jsx-loader": "0.12.0", "karma": "0.12.16", @@ -37,6 +38,7 @@ "react": "0.12.x", "reactify": "0.15.x", "rf-release": "0.3.2", + "rx": "2.3.18", "uglify-js": "2.4.15", "webpack": "1.4.5", "webpack-dev-server": "1.6.5" @@ -63,4 +65,4 @@ "browserify-shim": { "react": "global:React" } -} \ No newline at end of file +}