React Router with Loadable Components error

React Router with Loadable Components error

I've created a repository with a basic example that triggers this error in case it helps:

I've created a repository with a basic example that triggers this error in case it helps:


I'm trying to use Loadable Components in a SSR set up with react-router-dom 4.3.1loadable-component 5.6.0 and react-dom 16.8.1

Here is a component example to which I'm trying to apply loadable-component:

import React from "react";

const About = () => <h2>About</h2>;

export default About;

This is imported in the App component like this:

import loadable from "@loadable/component";
const About = loadable(() => import("./About"));

And passed as a prop to Route in the same App component:

<Route path="/about/" component={About} />

But I keep getting the following warning in the Developer Tools console:

Warning: Failed prop type: Invalid prop component of type object supplied to Route, expected function

If I use an alternative syntax as suggested in the first answer:

<Route path="/about/" component={props => <About {...props} />} />

The warning disappears, but the route to /about still gives an error when the link is clicked:

Uncaught Error: Loading chunk About failed.
(missing: http://localhost:3000/about/About.bundle.js)
    at HTMLScriptElement.onScriptComplete (VM1805 app.bundle.js:114)

I followed the documentation about setting up loadable-components in SSR, so I've set up the client, the server and also the babel plugin as indicated.

Any idea what's wrong here?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

URLs and Webpack in Reactjs

URLs and Webpack in Reactjs - I am still a newbie in ReactJS. I've been following series of tutorials and articles on the framework and decided to start putting what I've learnt so far into practice.

Learn ReactJS with Webpack 4, Babel 7, and Material Design

Quick and simple, fast guide on integrating ReactJS with Webpack, Babel and Material Design. This is a short tutorial which will get your ReactJS app running with Webpack and Babel.

Setting up Reactjs using Webpack 4 and Babel 7

In this tutorial we will be setting up our very own reactjs from scratch using webpack and babel, so grab your pen and paper lets spin the learning wheel.