Discussion on: How to build a news app with JavaScript and React Native

ethan profile image
Ethan Stewart

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!

msal profile image
Mohammed Salman Author

thanks, i might've forgot that i added the await keyword.