Front-end and Server connection issues when accessing from another device

Okay so guys, I created a small note taking web-app on MERN stack. The front-end is running at localhost:3000, and the backend is running at localhost:5000, I am getting all the requests and response from the backend using axios. In the backend I’m using app.use(cors()) to avoid any connection issues.
So the issue is, It works perfectly on the pc I’m hosting it on, but when I try to access it from my another device (which is connected to the same wifi as my pc) my putting :3000 in the address bar, it shows the frontend, but when I try to save notes or get them, it doesn’t work. But when I visit :8000/get, I can see my all notes saved there.
So the final issue is, it’s working perfectly on the hosted device, but another device (connected to the same wifi) the front-end and back-end isn’t working together, however they are accessible when separately visiting their respective ports.
For ease, I’ll attach my main react component file, and server.js file

Create.jsx (Main react component)

"use client"
import React, { useState, useEffect } from 'react'
import axios from "axios";
function Create(){
    useEffect(()=>{
        axios.get("http://localhost:5000/get")
        .then(result => setnotes(result.data))
        .catch(err => console.log(err))
        }, [])
    const [notes, setnotes]= useState([]);
    const [note, setnote]=useState();
    const addNote=()=>{
        axios.post("http://localhost:5000/add", {note: note})
        .then(result => console.log(result))
        .catch(err => console.log(err));
        document.getElementById("input").value=""

    }
    const removeNote=(id)=>{
        axios.delete("http://localhost:5000/delete/"+id)
        .catch(err => console.log(err))
    }
    return(
        <div>
            <textarea className='form' placeholder='Enter note' onChange={(e)=>setnote(e.target.value)} name="" id="input" cols="30" rows="10"></textarea>
            <br />
            <button onClick={addNote} className="button" type="button">Create</button>
            {
                notes.length===0
                ?
                <div><h2>No notes at the moment</h2></div>
                :
                notes.map(note => (
                    <>
                    <div className='result'>
                        {note.note}
                    </div>
                        <button onClick={()=> removeNote(note._id)} className='delete'>Delete</button>
                        </>
                ))
            }
        </div>
    )
}

export default Create

server.js (server entry point)

const express=require('express');
const mongoose=require("mongoose");
const cors=require("cors");
const collection=require("./models/note.js");
mongoose.connect("mongodb+srv://<username>:<password>@cluster0.fetyubc.mongodb.net/")
const app=express();
app.use(cors());
app.use(express.json());

app.get("/get", (req, res)=>{
    collection.find()
    .then(result => res.json(result))
    .catch(err => console.log(err));
})
app.post("/add", (req, res)=>{
    const note=req.body.note;
    collection.create({
        note: note
    }).then(result => res.json(result))
    .catch(err => console.log(err))
})

app.delete("/delete/:id", (req, res)=>{
    const {id}=req.params;
    collection.findByIdAndDelete({_id: id})
    .then(result => res.json(result))
    .catch(err => console.log(err));
})

app.listen(5000, ()=>{
    console.log("server is running")
})

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật