score:0
this is something you could do in your router on the server. you can't do it in your react app, because that defeats the purpose of having js-less content to serve (since you'd be using js to deliver the "static" content).
if you don't have a server set up yet with a router, that will take some time. but once you do, a simple check in the route will suffice.
// in hapijs, for example:
handler(request, reply) {
if (isauthenticated(request)) {
reply.view('dashboard')
} else {
reply.view('static_page')
}
}
Source: stackoverflow.com
Related Query
- Serving a static html page from a single page react app with react router
- Azure Static App Route configuration with React Router
- static HTML landing pages with Create React App
- react router preload data from multiple components with a single loader animation
- Hosting a React app with React Router on a static server
- Django static file serving in conflict with React Router
- Exclude index.html from express.static when serving React app with Express
- React Router Link with params not reloading page with new data from componentDidMount and Redux axios data fetching
- Embed a single react component created with create-react-library into html page
- Serving static React app from server, crashing on refresh
- ReactJS: Go to anchor link in HTML with react router dom only after the full page load
- How to give props from one page to another with react Router
- How to properly set property(if user is logged) from cookie after page opens or F5 in React with router and redux
- Force re-render the react component in the jquery single page application or in static html site?
- NVD3 chart in React app draws html that do not ever then disappear from the page
- React app rendering empty page with no error from the console
- Unable to make api calls from React Single Page app
- React Single Page app with browserHistory possible?
- SSR React APP with Static router on express
- How to pass data from one page to another with react router dom Link?
- Serving a static html page using flask, with a parameter
- Adding underline to current page section in single page react app with Chakra.ui
- How do I navigate to a dynamic page with React Router from a list of elements?
- Handling static links from Wordpress API page content in React Router
- Can't render out single page data from list in a react application using router and WordPress API
- How to redirect from axios interceptor with react Router V4?
- React app error: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS
- add raw HTML with <script> inside Gatsby React page
- Serve another(standalone) page or static file in website built with react
- How to make react router work with static assets, html5 mode, history API and nested routes?
More Query from same tag
- React hooks stale state
- How do I stop my React application from continuously updating an element based on an input field?
- React: Is it possible to access a DOM element's props?
- How to load first menu item by default with a different Router Link
- How to fix my sorting function in my crud table?
- How to use one array as keys for another array?
- Why does my React component not render when using React-Router?
- Nginx reverse proxy multiple react apps
- Reset context from helper service
- Rendering a list of items in React with shared state
- Is React-Native a single threaded execution or multi-threading execution?
- ReactJS - adding .then to function makes "this.state.searchText" invalid
- Add an event to a Stateless Component in ReactJS
- React: No `render` method found on the returned component instance: you may have forgotten to define `render`
- I cant the value of the element name - e.target.name returns undefined
- How to get rid of code repetition here (lint errors)
- General question - when to use redux store?
- React TypeScript: (props: OwnProps) => Element' is not assignable to type 'FunctionComponent<{}>
- Change route after submit form in react with typescript
- How to find the given image source (url) is in svg format?
- React, Enzyme : Cannot read property 'history' of undefined
- Best way to check if there is already a token in local storage using use effect in React Context
- How to render the JSON file in reactJS
- Cannot receive to get clicked button value in React.js
- "[ts] Unterminated regular expression literal."
- How get marker position on dragend in React (google-map-react )
- How to implement long polling for React + axios
- How to nest components under a common header
- is it possible to navigate to another route and going to a specific bookmark right after?
- Importing Mousetrap in React project - Cannot read property 'bind' of undefined