Relative Content

Tag Archive for javascriptreactjsnode.jsmongodbmern

TypeError: Cannot read properties of undefined (reading ‘map’) in react-js

import React, { useEffect, useState } from ‘react’; import axios from “axios”; import ‘./List.css’; import { toast } from “react-toastify”; const List = () => { const url = “http://localhost:4500”; const [list, setList] = useState([]); const fetchList = async () => { const response = await axios.get(`${url}/api/food/list`); console.log(“the response data”, response.data); if (response.data.success) { setList(response.data.data) […]

how to add payment methppd in frontend

I am trying to add payment method in my program but it is not working properly, can anyone suggest me how can I fix this problem in MERN programming.

getting unauthorized 401 error in MERN app

I am developing a web app on MERN stack blog app, I have developed the backend API in render, frondend in vercel and they are working fine on postman and working fine in localhost. The problem is when I’m connecting backend with frontend and after giving a post request -adding a new comment to a post it failed with 401 anauthorized,its not working on deployment but working right at local machine. Whenever I’m running this it shows unauthorized 401 error. Here’s the code I don’t know what I’m doing wrong. What I could figure out from reading the error is that the problem is in auth some axios like error code, it shows error name as 401 unauthorized.