score:5
as i understand, once you have opened the app in your browser, any changes to the url will not be requested from the server but instead handled client-side in react router, even if you reload the page or write something manually into the address bar.
this is not true. upon manual change in address bar (and pressing enter), you will always first hit server router.
it is very likely that your server, no matter which url is hit, will always render your index.html
which contains your react app. something similar to this:
app.use(express.static(path.join(__dirname, 'dist')));
app.get('*', function(req, res) {
res.sendfile('./dist/index.html');
});
make sure your api requests do not conflict with this. if possible, share some code, so we can review what could go wrong.
Source: stackoverflow.com
Related Query
- Force react-router app to send URL requests to server
- first time loading of sub url that needs data from server in react app using React Router v4.3 and create-react-app
- React router with browserHistory goes to server on every URL change
- How we can convert client side rendering react js app to server side rendering using react router 4?
- Hosting a React app with React Router on a static server
- React router does not change view, but url is changed - App is load inside iframe
- "Internal Server Error" when refreshing page or typing URL manually when using React Router
- Proxying requests from client react app to server with create-react-app and webpack dev server
- When attempting to stub a request in Cypress IO (JS) against a React app using fetch, the requests still call through to the server
- How to send URL parameter from react router to a toolbar?
- Server rendering React app behind a URL prefix with react-router
- I am running a react app locally on apache2 server. It gives error URL not found on this server
- React Router URL not found if refresh page - Create React App
- Having trouble making AJAX requests to an express server when using React Router
- Send axios (api) requests from react app deployed on heroku
- Axios get request from local server url from within React app
- why react router url changes but component does not load in my nested router app
- How to send image from React app to api server
- react router with url from server not matching root
- How to send requests to a nodejs backend from a React app served by nginx with ssl configured
- Getting 404 when Auth0 callback is invoked with React router and .Net Core server app
- React router changes url but not view
- How to deploy a React App on Apache web server
- How to inject API server URL when deploying react frontend?
- How to configure webpack dev server with react router dom v4?
- React router - Update URL hash without re-rendering page
- Check if Logged in - React Router App ES6
- React router not working after building the app
- How to send params in useHistory of React Router Dom?
- React Router Without Changing URL
More Query from same tag
- Problem with sending Image from React to Flask
- Add a subclass in d3 chart hierarchy
- How to pre-fetch a component for later in React?
- Docker ReactJS Communication with other container
- why my react hook state only update after two clicks
- React typescript - object is possibly undefined
- How to automatically do line break in <pre> tag?
- How to display backgroung image once it's assigned as constant using styled components
- How to checked checkbox using state in react in class based components
- Console.log Changes based on user input after being printed
- Recharts - Set domain without axis in BarCharts
- Drag circles with scaleLinear initial position
- How to share a specific variable between different react components
- React/Webpack Css imports from node_modules are not loading correctly
- Why my map fuction dont works in an array?
- problem in accessing the scss variables in react components
- Update state in React: array element nested in Object
- How to position all dates on xAxis using recharts and stretch width on 100% in React?
- How to filter a table using multiple user inputs on a React.js app
- Generate data into recharts bar chart using List of DTO
- React Issue - Child state changes the parent's state
- Generate element from submit React.js
- get variables through their name in react
- Component updates even though prop has not changed
- How to reset Google recaptcha with react-google-recaptcha
- How to detect if media is playing or not in reactjs or Is it possible?
- How to reset password using React and Redux?
- assigning array previous objects to next element and updating the last
- React - Render HTML When Setting a State After Fetching Data
- Pass a valid time type usnig moment from React setState to postgres