zacfukuda / universal-app-react-router

Super Simple Universal React App with React Router & Express.js
https://www.mokuji.me/article/universal-app-react-router
MIT License
6 stars 4 forks source link

fixed places of router config logic #3

Open xiaoyunyang opened 6 years ago

xiaoyunyang commented 6 years ago

A few improvements

  1. renderRoutes does not need to be wrapped in <Switch /> because according to the source code, renderRoutes already wrap <Routes /> in <Switch />.
  2. Pushed <Header /> down a component level so <Header /> can receive route to know which component is currently selected. This is helpful for indicating an active status for the tab in the navbar that correspond to the selected page.
  3. Added .active styles to the css and created the logic in the <Header /> to underline the tab corresponding to the current page.