Add routing for SSR

This commit is contained in:
Tom Raithel
2017-02-20 12:44:27 +01:00
parent 4fd02cc52e
commit 6cfd53a47a
9 changed files with 204 additions and 116 deletions

24
components/Router.js Normal file
View File

@@ -0,0 +1,24 @@
import React from 'react';
import PageIndex from './PageIndex';
import PageOverview from './PageOverview';
import PageHelp from './PageHelp';
export default function Router({ pageName, ...props}) {
let Comp;
switch (pageName) {
case 'index':
Comp = PageIndex;
break;
case 'overview':
Comp = PageOverview;
break;
case 'help':
Comp = PageHelp;
break;
default:
Comp = 'div';
break;
}
return <Comp {...props} />;
}