1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Refactor API Calls into a Service Function

    reactReact

    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.