Using async useffect in React

Using async useffect in React

const [profile, setProfile] = useState([]);
  
useffect(() => {
  const getProfile = async () => {
    let response = await fetch('https://example.com/api/user/1');
    let data = await response.json();
    setProfile(data);
  };
    
 getProfile();
}, []);

click for more React codes, read about react doc