create seperate file for requests react
1
You can do it like this 1. Create the method you want to export inside suppliers devices.js.
SupplierServices.js
Export const fetchData = async () => {
Const res = await axios.get(your url)
Console.log(res)
}
2. Now import the fetchData method from supplierServices
Import { fetchData } from './SupplierServices'
Const Supplier = () => {
useEffect(.() =>{
fetchData ()
} )
}