await in react in function component code example
Example 1: await in react in function component
const here = async () => {
console.log("here we go");
}
Example 2: async await class component react
async componentDidMount() {
// when react first renders then it called componentDidMount()
const response = await fetch('https://jsonplaceholder.typicode.com/users');
const json = await response.json();
console.log(json);
}