i apparently try to fetch data from local nodejs server but got weird error. this is simple server with express
let express = require('express')
let server = express()
server.listen(3100)
server.get("/", (req, res) => {
res.send("hello") })
and this is the code in my react. i only use it in useEffect
fetch('http://localhost:3100/', {
headers: 'Access-Control-Allow-Origin',
method: "GET"
})
.then(res => res.json())
.then(response => {
console.log(response)
})
.catch(err => console.log(err))
and i got this error
Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)'
i have no idea why is this happening, i look around the internet but still didnt get the solution. thanks for any suggestion!