Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Use React.lazy to do code-splitting with React Suspense


    A new way of doing code-splitting in React apps has been released in React v16.6.0. It allows us to use Suspense tag with dynamic import statements to send heavy components over the wire to the user when they are needed and not before.

    In this example we are going to see how to use React.lazy and Suspense to avoid sending whole of lodash and moment JS libraries and instead do it once it's actually necessary.