Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var React = require('react');
var ReactDOM = require('react-dom');
var Navigation = require('navigation');
var Component = require('./Component');
Navigation.settings.historyManager = new Navigation.HTML5HistoryManager();
exports.register = function (props) {
// Configures the Navigation router with the two routes.
// This configuration is also used server side to power the JSON Api.
Navigation.StateInfoConfig.build([
{ key: 'masterDetails', initial: 'people', states: [
{ key: 'people', route: '{pageNumber}', component: Component.Listing, defaults: { pageNumber: 1 }, trackCrumbTrail: false, transitions: [
{ key: 'select', to: 'person' }]},
{ key: 'person', route: 'person/{id}', component: Component.Details, defaults: { id: 0 } }]
}
]);
// Client renders so React can catch up with the server rendered content.
// Browsers that don't support HTML5 History won't get this progressive enhancement.
if (props && window.history && window.history.pushState && window.XMLHttpRequest) {
Navigation.start();
render(props);