Great post! I might have to go play with this news API sometime.
One possible improvement in code clarity: in your getNews function, should this
let result = await fetch(url).then(response => response).then(response => response.json());
be replaced with this?
let result = await fetch(url).then(response => response.json());
Since you're just passing it along to the next then call, it seems redundant to me and could be removed to make the code a little more clear. If you do have a reason for doing it that way, I'd love to hear why!
thanks, i might've forgot that i added the await keyword.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.