📌  相关文章
📜  为请求创建单独的文件反应 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:33.478000             🧑  作者: Mango

代码示例1
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 ()
 } )
}