'why im getting this error when deploy my react app on firebase?

The app runs well on local but I receive an error when I deploy it to firebase or another platform. This error does not occur on my local machine.

enter image description here

The error is in the functionality where the frontend requests for data from the backend and then uses array.map to display each element of the data. The data is in Array format that is checked.

Running the frontend with npm start and backend separately is giving no error. But when I try to build the static file using npm run build and serve those files, then I am getting react-dom.production.min.js:186 TypeError: r.map is not a function.



Solution 1:[1]

Json.parse takes a arguments as Json string and converts to javascript object. but if we provide wrong arguments then it gives the same error shown in your image , Please check if arguments valid or not.

for references : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shaurya Rastaugi