Member-only story
Why Would You Implement A Backend For Your React App?
You ain’t gonna need it. But once you do, it is too late! Unless…?

A React web-app interacts with the user dynamically. It avoids interruptions of the user experience between successive pages. It rather appears to be a desktop application than a website.
You can do quite a lot with a React web-app. Even if it has no (own) backend.
- You can server different routes. React adds the path of a route after a
#
. Usually, anything after the#
is ignored. But React-Router uses this information and provides it to your web-app. - You can work with local states. React provides the
useState
-hook and supports a Redux-store - You can call any (existing) API. You can send or fetch data.
Why would your app need a backend?
Maybe you need to write your own web-services. Services that access your database. Services that cater to the specific needs of your app. Services that provide the exact data your app needs in the exact format your app needs.
Maybe you need to render your web-app at the server-side. Completely rendered HTML pages enable search engines to crawl the content of your app.
Maybe your app needs to open socket-communication to support real-time events.
There are plenty of good reasons, why your app needs a backend. If your app needs a backend to achieve its purpose, then go ahead. Implement a backend!
But what if your app does not yet really need a backend?
When you start coding your React app, you may not know for sure whether you would need a backend later. You don’t know all the user stories. You don’t know all the non-functional requirements. Like the required load performance, scalability, HTTP-response behavior.
You cannot foresee the future.
YAGNI! “You ain’t gonna need it!”
This best practice in software development tells you to not add anything to your code until you actually need it. You implement the code you need to solve your problem at hand. Not more.