Chan Park
1 min readMay 6, 2020

--

Reusing the class to fetch data for React

Recently, while learning React, I tested whether fetch () related class that I made while learning javascript can be reused. Of course, the ‘export default Adapter’ in the bottom line was added to be accessible from other components.

How to call the function defined in the Adapter class is as follows.

I think it’s better to be a lazy programmer than to write the same routine over and over again.

--

--