Answer the question
In order to leave comments, you need to log in
React. Lazy loading component only when using it?
Right now my application has asynchronous loading of components (using react-router).
But one way or another, all components are loaded, even if they are not used.
How can I make it so that the component is loaded only when it is used (If the user goes to a certain route)?
Answer the question
In order to leave comments, you need to log in
https://reactjs.org/docs/code-splitting.html here everything is chewed in the most detailed way. It's hard to tell more
There is an example with react-router.
For example, the site works https://tools.xakplant.ru/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question