Hi I am getting his error : Unexpected token '<', "
I a beginner in web developing, I am trying to build a todo list using MERN stack but when I try to render my todos on frontend (react app ), I encountered an error saying Here's my code (App.jsx) Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON import { useEffect,useState } from "react"; export default function App() { const[todos,setTodos] = useState([]); useEffect( () => { async function getTodos(){ const response = await fetch("/api/todos"); console.log(typeof response); const todos = await response.json(); setTodos(todos); } getTodos(); } ,[]); re
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.