Javascript
Error: Uncaught (in promise) ReferenceError: response is not defined
Error
Message
Uncaught (in promise) ReferenceError:
response is not defined
|
Wrong code:
fetch("http://localhost:3000/articles/" + this.idarticle)
.then(
response.json()
)
|
Solution:
Create an Arrow-Function
fetch("http://localhost:3000/articles/" + this.idarticle)
.then(response => response.json()
)
|
Oder (param)
=> expression
fetch("http://localhost:3000/articles/" + this.idarticle)
.then((response) => response.json()
)
|