Answer the question
In order to leave comments, you need to log in
A site using React + React-router-dom, is it possible to create a site without reloading the page, and load the necessary components on request to the server?
Good time! Not so long ago I started learning js, I have the skill of writing a React CRUD app.
I decided that it would be a good thing to make up a personal portfolio for a job search, where there will be a registration form + working authorization, etc.
So, I wanted to ask you guys! *Open my eyelids* The only servers I've come across is a typical Gulp, webpack configured document to raise the server so I don't know how the Web Pages themselves work on the production domain, and what's going on there.
In general, is it possible to make a site *many pages*, but so that when changing values in the DOM*e, the page does not reload, but replaces the values and changes dynamically? At the same time, so that all JS files do not load the page, but that the necessary React Component * s are loaded modularly. Set up React-route-dom with server? What's the magic guys?
How to implement it? What to read and how to google?
Answer the question
In order to leave comments, you need to log in
React-router-dom to work with history in the browser. Everything is written in the documentation. So that the components are not assembled into one bundle, but are pulled up gradually, you need to wrap the components in React.lazy using dynamic imports. Google and get it.
In order for all this to work not only in the webpack-devserver on the local, but also on the real server, you need to configure it "for all routes except files, give index.html". There are many articles on the Internet, google nginx react spa configuration.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question