NavBar/Footer are hidden on dynamic routes in production
See original GitHub issueI have this Paths file:
import {
Register,
} from '../components/pages/'
import StaticRoutes from 'react-static-routes'
const Paths = (
<Switch>
<Route exact path="/registro" component={Register} />
<StaticRoutes />
</Switch>
export default Paths
My Pages index:
import universal from 'react-universal-component'
const Login = universal(import('./auth/login/'))
const Register = universal(import('./auth/register/'))
export {
Register
}
And my App.js
const App = () => (
<Provider store={store}>
<Router>
<ThemeProvider theme={theme}>
<div className="content">
<NavBar />
<div className="emp-container">{Paths}</div>
<Footer />
<Modal />
</div>
</ThemeProvider>
</Router>
</Provider>
)
export default hot(module)(App)
In localhost all work fine. But in production (react-static build
), when i navigate to dynamic route, only render the <div className="emp-container">{Paths}</div>
and <NavBar />, <Footer />, <Modal />
dont are rendered (It do not appear in html inspector). With static routes all works fine.
Versions:
"react": "^16.0.0",
"react-static": "^5.9.7",
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
javascript - React Router, hide Nav & footer on certain pages ...
Hi you can do it by having a state that only when the state is true the nav and footer will render: function...
Read more >Dynamic Navigation in Next.js – How to Render Nav-Items ...
I've lately been noticing a pattern in React applications: developers protect certain routes on a web app from unauthorized users.
Read more >3 Ways to Hide Navigation Bar in React Native Application
If you want to hide the header dynamically on click of a button then you can visit our post on Hiding React Navigation...
Read more >How to reuse common layouts in Angular using Router
Problem with this approach is that layout is unnecessarily recreated on each route change. We can check that by putting console logs in...
Read more >Angular Material Navigation Menu - Complete Responsive ...
We have to use angular routing as well, and we are going to do that ... on the end of the navbar and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
withRouteData
andRouteData
only need to be inside the<Router>
component. If all you are looking for is the history object though, you can get it with thewithRouter
HOC.@tannerlinsley only in
withRouteData
connected components? Or in all files, like redux actions file?You can try it in: https://github.com/luisfuertes/react-static-demo