var Route = ReactRouter.Route; var DefaultRoute = ReactRouter.DefaultRoute; var NotFoundRoute = ReactRouter.NotFoundRoute; var RouteHandler = ReactRouter.RouteHandler; var Link = ReactRouter.Link; var ProviderGrid = require('./providers.jsx').ProviderGrid; var Admin = require('./admin.jsx').Admin; var NotificationCenter = require('./notifications.jsx').NotificationCenter; var App = React.createClass({ getInitialState: function() { return { root: null }; }, componentDidMount: function() { // pass the connection and the id of the data you want to synchronize var client = new diffsync.Client(io(), "root"); client.on('connected', function(){ // initial data was loaded - pass it on to our state this.setState({ root: client.getData() }); // if we're using browser-refresh to auto-reload the browser during development, then // we'll receive the URL to a JS script in this location (see Server.js) if (this.state.root.browserRefreshURL) { var script = document.createElement('script'); script.setAttribute('src', this.state.root.browserRefreshURL); document.head.appendChild(script); } }.bind(this)); client.on('synced', function(){ // server has updated our data - pass it on to our state this.setState({ root: client.getData() }); }.bind(this)); client.initialize(); }, render: function() { var root = this.state.root; return root && (
); } }); var Home = React.createClass({ render: function() { return (
); } }); var NotFound = React.createClass({ render() { return (

That page could not be found.

) } }); var routes = ( ); ReactRouter.run(routes, ReactRouter.HistoryLocation, function (Handler) { React.render(, document.body); });