Нема описа

fetch_json.js 271B

1234567891011
  1. import * as React from 'react';
  2. export default async function fetch_json(url, setJson) {
  3. try {
  4. const response = await fetch(url);
  5. const json = await response.json();
  6. setJson(json);
  7. } catch (error) {
  8. console.error(error);
  9. };
  10. }