In Lesson 8 of the React-Router docs, discussing "Index Routes", they describe the following paragraph:
This would work fine, but its likely we'll wantto be attached to
a route likeand
Aboutin the future. A few reasons include:
- Participating in a data fetching abstraction that relies on matched
routes and their components.
- Participating inhooks
- Participating in code-splitting
Also, it just feels good to keep
decoupled fromand let the route config decide what to render as
the children. Remember, we want to build small apps inside small apps,
not big ones!
Every route is associated to a component (not the other way around). It simply says that you may want for the component to be rendered not only in
/ (default path without using any router) but on a given route.
I'm not certain about this one, I think it refers to the capability of a component to load different data based on the route, minimizing the payload.
For big web apps it’s not efficient to put all code into a single file, especially if some blocks of code are only required under some circumstances. Webpack has a feature to split your codebase into “chunks” which are loaded on demand.