generic api call with axios that can then be placed in a react useEffect() hook with the slice of state you want to set
import axios from 'axios';
export function Foobar(setter) {
axios
.get(/** api call inset here **/)
.then(res => setter(res.data))
.catch(err => console.log(err));
}
/**
* can then import
* and call with name in another file
* for eaxmple
* import Foobar from './Foobar';
* // then use in useEffect()
* Foobar(setVariableNameForData);
* then you could reuse this elsewhere.
*/