Refactor API Calls into a Service Function

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet
Published 2 years ago
Updated a year ago

Our components shouldn't be concerned with the implementation details around how we call our back end services. We may need to change details of how the API is called, we may want to add caching or offline storage and we may need to use the same API call in other components. To clean up our component code and abstract those details away from our component code, we'll move our fetch call into a service function and update our component to use our new function.