One of the reasons to use the async/await syntax is to avoid the nested code that comes from .then() and .catch(). The fetchData function can simply become:
Keep in mind that this could result in an unhandled promise rejection (this was true before as well.) To actually handle errors from that fetchApi interaction just wrap a try catch:
Hey all! š Iām Ryo, a Sr. Design Technologist at PlayStation. I do web dev with React/TS/Node and game dev with Unity/C#/C++/OpenGL/DirectX. Feel free to ask me any questions! š¤
One of the reasons to use the async/await syntax is to avoid the nested code that comes from .then() and .catch(). The fetchData function can simply become:
Keep in mind that this could result in an unhandled promise rejection (this was true before as well.) To actually handle errors from that fetchApi interaction just wrap a try catch:
Good tips š„ I def need to use more try/catch in my workflow š