The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Member-only story

How to Add Multiple Entry Points to Your React App

--

Photo by Antonio Batinić from Pexels

Often in our application, we require multiple entry points or html pages at our client side user interface. For instance, let’s take a basic scenario where you are making an application that requires a login page, a registration page and your application’s main index page. Though we can handle this requirement with React routing by creating different routes for login, registration and application, it comes with its own set of caveats.

For example, more often than not your login and registration page will have completely different components structure than your main application. And that is why it would be better to have different entry points and code segregation. Though Create React App gives you many out of the box features, it does not support multi entry points functionality, as it is supposed to be a “SPA”.

Having separate unsecured HTML pages for registration and login also makes it a lot easier to handle server side logic for security.

So in this article I will describe the detailed steps to transform your Single Page CRA generated React App to a multi entry point application.

The first step is to eject your React app so that you can configure your Webpack.

Ejecting from CRA

--

--

The Startup
The Startup

Published in The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Rahul Mehra
Rahul Mehra

Written by Rahul Mehra

One must cultivate one’s own garden

Responses (2)