在本机反应中导出异步函数

时间:2021-05-23 21:04:18

标签: react-native-android

使用此功能时无法导入数据。

export const categories = async () => {
  try {
    const response = await fetch('url');
    const json = await response.json();
    console.log(json);
  }
  catch (e) {
    console.log('We have the error', e);
  }
}

0 个答案:

没有答案