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
- 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