Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {RouterUtil} from 'react-onsenui';
import MainPage from './main-page';
import SecondaryPage from './secondary-page';
const initialState = RouterUtil.init([{
component: MainPage,
props: {
key: 'main'
}
}]);
const reducer = (state = initialState, action) => {
let routeConfig;
switch(action.type) {
case 'PUSH_PAGE':
const {route} = action;
routeConfig = state;
return RouterUtil.push({routeConfig, route});
case 'POST_PUSH':
return RouterUtil.postPush(state);
constructor(props) {
super(props);
const routeConfig = RouterUtil.init([{
component: MainPage,
props: {
key: 'main',
pushPage: (...args) => this.pushPage(...args)
}
}]);
this.state = {routeConfig};
}