[Solved] TypeError: Cannot read properties of undefined (reading 'prototype') React Typescript + Express

React JS Ab Siddik

Problem:

Recently, we working on a SPA(Single page application), we used React and Express to develop this application. But when we try to integrate React with Express we face "TypeError: Cannot read properties of undefined (reading 'prototype') React Typescript + Express" issue.


Solution:

We found that this problem happens when we mistakenly try to call backEnd stuff in our frontEnd. Actually, we have to instantiate both the app and express, use the const keyword as well.

const express = require('express');
const app = express();

Thank you for reading the article. Hope the given solution will solve your problem.