Questions tagged [react-static-router]

5 questions
1
vote
0 answers

In react-static with react-router, how can I access props.location in the route template?

I am very new to react-static and am trying to adapt an existing react-router app to use it. I have my static.config.js setup as: export default { getRoutes: async ({ dev }) => { return [ { path: '/details/someobject', …
okhobb
  • 758
  • 8
  • 22
1
vote
0 answers

How to render the menu from the routes defined at static.config.js file in an application build by react-static?

Following the official guide, it should be something simple like this: //App.js import React from 'react' import { useRouteData } from 'react-static' const { myRoutes} = useRouteData() function App() { console.log(myRoutes.length) return ( …
MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
1
vote
1 answer

Error: Failed exporting HTML for URL About (src\pages\About.js): Invariant failed

I add Switch router component to my project in order to set default page. When i build it gives the following error: Error: Failed exporting HTML for URL About (src\pages\About.js): Invariant failed - tiny-invariant.cjs.js:11 invariant …
MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
1
vote
0 answers

Make the outer layout aware of the current route in react static

My app has a structure like this: const App = () => ( ) However, I would like to make the layout depend on the type of page that is loaded. I know that there is a…
Xiphias
  • 4,468
  • 4
  • 28
  • 51
0
votes
1 answer

Invariant failed: You should not use outside a using Static Router

I'm getting an error trying to make a server side rendering using reactDomServer and Static Router. Im getting the following output: Error: Invariant failed: You should not use outside a at invariant…