This repo is for experimenting with lazy loading React and Redux code.
If implemented correctly, we can speed up loading React components via lazy-loading, and also dynamically load redux-related code instead of initializing everything in the entry file.
- Can a component safely reference a lazy file's
actions.js
without other files in the folder? - Can a component safely load a lazy file's
Component.js
without other files in the folder? - Can we easily load the requisite files when a lazy file's
action.js
orComponent.js
are referenced from another component?
- Successfully loaded
actions.js
by itself - Successfully loaded
Component.js
by itself, which includes requisite filesactions.js
,selectors.js
,reducer.js
- Problem:
Component.js
is bundled together with requisite files because they're not lazy-loaded. Some notes:- If you load
Component.js
first thenactions.js
,actions.js
won't be reloaded because the code already exists inComponent.js
- If you load
actions.js
first thenComponent.js
, the code foractions.js
is loaded twice.
- If you load
- Should we load all feature files when one of them is loaded?
- Should we allow each individual feature file to be lazy loaded?
https://blog.logrocket.com/lazy-loading-components-in-react-16-6-6cea535c0b52/