Add support for lazy loading Wasp routes
infomiho opened this issue · comments
Quote from here:
Lazy loading is a strategy that defers the loading of non-essential resources until they are needed, reducing the initial loading time and improving the overall performance of the application. In React, we can achieve lazy loading using the lazy function and the Suspense component, introduced in React 16.6.
Our current React Router version (v5) supports using React.lazy
: https://ui.dev/react-router-v5-code-splitting so it shouldn't be a big deal to implement this.
We should decide if we want to make this the default behaviour (some frameworks do this) or make it opt in.
Related Discord thread: https://ptb.discord.com/channels/686873244791210014/1236518598231588915/1236518598231588915