bradstiff / react-app-location

A package to avoid repetition with Routes and URLs, and reduce boilerplate with location param parsing in React Apps
MIT License
97 stars 8 forks source link

Will it workwith react-router 4.3.1? #10

Open YoomiAB opened 5 years ago

YoomiAB commented 5 years ago

After upgrading to react-dom 16.8 and react-router-dom 4.3.1 all routes are not rendered. Downgrading to 4.1.2 solves the problem.

None of the routes outside the are rendered when upgrading to react-dom 4.3.x Ie - the Sidebar and Header components are never rendered.

const AppRouter = ({isAuthenticated, ...rest}) => (
  //uses Router instead of BrowserRouter to use our own history and not the built in one
  <Router history={history}>
    <div className="appContainer">
      {SidebarLocation.toRoute({ render : (props) => privatePath({isAuthenticated, history, component:Sidebar, ...props}), invalid: NotFoundPage }, true)}
      <div className="app-MainContent content-container-parent ">
        {HeaderLocation.toRoute({ render : (props) => privatePath({isAuthenticated, history, component:Header, ...props}), invalid: NotFoundPage }, true)}

        <Switch>
          {/* Exact match and Strict match!!! */}
          {LoginLocation.toRoute({ render : (props) => publicPath({isAuthenticated, history, component:LoginPage, ...props}), invalid: NotFoundPage }, true, true)}

          {StartLocation.toRoute({ render : (props) => privatePath({isAuthenticated, history, component:DashboardPage, ...props}), invalid: NotFoundPage }, true)}
          {SearchLocation.toRoute({ render : (props) => privatePath({isAuthenticated, history, component:DashboardPage, ...props}), invalid: NotFoundPage }, true)}
          {SettingsLocation.toRoute({ render : (props) => privatePath({isAuthenticated, history, component:UserSettings, ...props}), invalid: NotFoundPage }, true)}

          <Route component={NotFoundPage} />
        </Switch>
      </div>
    </div>
  </Router>
)