/* Once we bootstrap the stores, we run react-router using Router.HistoryLocation The element is created and we just render it into the container */ Iso.bootstrap(function (state, _, container) { alt.bootstrap(state) Router.run(routes, Router.HistoryLocation, function (Handler) { var node = React.createElement(Handler) React.render(node, container) }) })
reaxt_server_render (path,render){ Router.run(routes, path,function (Handler, state) { render(<Handler {...generate_props(state)}/>) }) }
Router.run(routes, req.path, function(Handler) { var data = {authUser: req.session.user}; res.view('serverrendering', { markup: React.renderToString( React.createElement(Handler, data) ), initialData: JSON.stringify(data) }); });
connect.io.on('connect', function() { Router.run(routes, Router.HistoryLocation, function(Handler) { ReactDOM.render( React.createElement(Handler), document.getElementById('content') ); }); });
Router.run(routes, url, (Root) => { if (state) locals.state = 'window.__ReactInitState__=' + JSON.stringify(state) + ';'; method("layout", { locals: locals||{title:'',description:''}, body: React.renderToString(<Root {...state} />) }); });
reaxt_client_render (initial_props,render){ var first = true Router.run(routes,Router.HistoryLocation,function(Handler,state){ // first rendering use server side generated props, next one generate new props var props = first && initial_props || generate_props(state) render(<Handler {...props}/>) first = false }) }
/** Render static markup (server) **/ renderHtml (path, cb) { Router.run(routes, path, Handler => { cb(React.renderToString(<Handler data={this.pageData}/>)); }); }
Router.run(routes, Router.HashLocation, function(Root) { React.render(<Root/>, document.getElementById("main")); });
Router.run(AppRoutes, Router.HistoryLocation, function(Handler, state) { var HandlerElement = React.createElement(Handler, { path: window.location.pathname }); React.render(HandlerElement, document); });
Router.run(routes, req.path, function(Handler) { res.view('serverrendering', { markup: React.renderToString( React.createElement(Handler, data) ), initialData: JSON.stringify(data) }); });
Router.run(routes, function(Root){ React.render(<Root />, document.getElementById('app')); });
Router.run(Routes, function(Handler, state) { /*jshint ignore:start */ React.render(<Handler params={state.params}/>, document.body); /*jshint ignore:end */ });
/** Render a live React component into the DOM (browser) **/ render (domNode) { Router.run(routes, Router.HistoryLocation, Handler => { React.render(<Handler data={this.pageData}/>, domNode); }); }
Router.run(routes, function(Handler) { React.render(<Handler/>, document.getElementById('app')); });
// For cleaner URL's without hash, use this ... // Router.run(routes, Router.HistoryLocation, function(Handler) { Router.run(routes, function(Handler) { React.render(<Handler/>, document.getElementById('app')); });