I am using axios library for fetching data from the local json file but when i make get request it gives me error 404 not found. Here is my file structure.
If you created this file structure using create-react-app command you have to add your json files into public folder. then change your axios path like bellow
handleSubmit = (e)=>{
e.preventDefault();
var username=e.target.username.value;
var password=e.target.password.value;
axios.get('./data.json')
.then((res)=>{
console.log(res.data);
}).catch((err)=>{
console.log(err);
})