2020-11-11
1624
#react
Glad Chinda
74
Nov 11, 2020 â‹… 5 min read

Lazy loading React components

Glad Chinda Full-stack web developer learning new hacks one day at a time. Web technology enthusiast. Hacking stuffs @theflutterwave.

Recent posts:

Auth.js adoption guide: Overview, examples, and alternatives

Auth.js makes adding authentication to web apps easier and more secure. Let’s discuss why you should use it in your projects.

Clara Ekekenta
Sep 12, 2024 â‹… 10 min read
Lucia Auth: An Auth.js Alternative For Next.js Authentication

Lucia Auth: An Auth.js alternative for Next.js authentication

Compare Auth.js and Lucia Auth for Next.js authentication, exploring their features, session management differences, and design paradigms.

Pascal Akunne
Sep 12, 2024 â‹… 4 min read
This image features the Angular logo, a stylized "A" inside a red hexagon, which is positioned at the center of a geometric, abstract design. The background consists of various shades of purple and blue, overlaid with concentric circles and lines that emanate from the center, giving a sense of motion or animation. The red circles within the background also suggest movement or transitions, which could symbolize the dynamic nature of route animations discussed in the article. The image relates to the article's focus on Angular route animations, visually emphasizing the importance of transitions and movement within Angular applications. The abstract patterns and use of color gradients give a modern, tech-forward feel, aligning with the idea that animations enhance user experience by adding engagement and fluidity to user interactions within an Angular app.

Learn how to animate transitions in Angular apps

While animations may not always be the most exciting aspect for us developers, they’re essential to keep users engaged. In […]

Emmanuel Odioko
Sep 11, 2024 â‹… 9 min read

Understanding env variables and containers in Astro 4.10

Astro, renowned for its developer-friendly experience and focus on performance, has recently released a new version, 4.10. This version introduces […]

Peter Ekene Eze
Sep 10, 2024 â‹… 9 min read
View all posts

6 Replies to "Lazy loading React components"

  1. Hey! Thanks for your post!

    Using lazy routes, after updating the app, if you do not refresh the app on the browser, it will try to load an old version of the bundle. so error “Uncaught SyntaxError: Unexpected token <” come up. How do you prevent that?

  2. Hello @Devin, sorry this response is coming really late. I didn’t receive any notification for this comment.

    There isn’t any particular reason for using @reach router here. In fact using react-router will also work just fine. I think the React documentation even uses react-router in their route-based code splitting examples.

    I hope you find this answer helpful.

  3. Hey, thanks for your feedback. I know this response is coming quite late but I still hope you could find it useful.

    You could setup live reload using maybe webpack-dev-server or any other tooling that fits into your project setup. That way, the browser tab automatically refreshes when files change, without you having to manually do that.

  4. Hey Mate, #GladChinda,

    Very well written article. I was searching for dynamically loaded react components & came across this page. It covers both React Lazy & Loadable part. Thank you so much.

Leave a Reply