--:--









Quiz for useEffect with API Calls

Course: REACT | Subject: React | Topic: API Integration



Logo

Q1: What is the primary purpose of useEffect in API calls?

Logo

Q2: When does the useEffect hook run by default?

Logo

Q3: How to run useEffect only once on component mount?

Logo

Q4: What can cause an infinite loop in useEffect?

Logo

Q5: Which hook is used to fetch data in functional components?

Logo

Q6: Where should the fetch or Axios call be placed?

Logo

Q7: What does the cleanup function in useEffect do?

Logo

Q8: How do you handle async fetch inside useEffect?

Logo

Q9: Why can’t useEffect callback be async?

Logo

Q10: How to update component state after fetching data?

Logo

Q11: What is a common mistake when using useEffect with API calls?

Logo

Q12: How to cancel API requests on component unmount?

Logo

Q13: Which hook dependency causes useEffect to re-run?

Logo

Q14: What happens if you omit the dependency array?

Logo

Q15: How to prevent multiple API calls in useEffect?

Logo

Q16: Which lifecycle phase does useEffect mimic?

Logo

Q17: How do you show loading state with API calls?

Logo

Q18: How to handle errors during fetch in useEffect?

Logo

Q19: What is the best place to trigger an API call?

Are you ready to start test? Set your time limit