Sign in Go Pro

Build a React Native Application

Refactoring Network Code into a React Native Shared Library

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



Once you have several blocks of repeating code, it's important to refactor your code so that it stays easy to read and debug.

We'll refactor all the network calls to use a single shared library, and show how to export the network call, and import it into the components.

Summary of Content:

  • Make a new lib directory
  • Copy the save item code, and make it generic for any network call
  • Import the new library code into the component
  • Use the library function to simply the code




There are no comments on this lesson, start the conversation below ...

You need to go PRO to post comments.

Lessons in Build a React Native Application