I am new to the React Framework. I am trying to fetch data from my Node Backend. The data I fetch keep returning 'Undefined'.
Here's my code:
import React, {useState, useEffect} from
"react";
function App() {
const [response, setReponse] =
useState([]);
useEffect(() => {
fetch("http://localhost:5000/api").then(
res => {res.json()}
).then(
data => {
console.log({data});
}
)
});
What am I not doing right?