From f7bccd6d3b60cb049b247b2033ae81b339dd726a Mon Sep 17 00:00:00 2001 From: Aminadav Glickshtein Date: Thu, 28 Apr 2022 21:37:55 +0300 Subject: [PATCH] Update 23_fetching_data_using_hooks.md --- 23_Fetching_Data_Using_Hooks/23_fetching_data_using_hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/23_Fetching_Data_Using_Hooks/23_fetching_data_using_hooks.md b/23_Fetching_Data_Using_Hooks/23_fetching_data_using_hooks.md index f895e8e..5db2daf 100644 --- a/23_Fetching_Data_Using_Hooks/23_fetching_data_using_hooks.md +++ b/23_Fetching_Data_Using_Hooks/23_fetching_data_using_hooks.md @@ -29,7 +29,7 @@ # Fetching Data Using Hooks -In the previous sections, you have learned how to fetch data using fetch and axios. In this section , we will use the useEffect hook to fetch data. We can use fetch or axios but I prefer to use axios. In React hooks, you don't have to use componentDidMount life cycle separately to fetch data. The useEffect has incorporate the React life cycle methods(mounting, updating and unmounting). Let's convert the code we wrote on day 18 to React hooks. We need to import the useEffect from react. The useEffect takes to argument that is a callback and an array. If the array is empty it behaves as componentDidMount life cycle where if the array has other properties, it will behave as updating too. +In the previous sections, you have learned how to fetch data using fetch and axios. In this section , we will use the useEffect hook to fetch data. We can use fetch or axios but I prefer to use axios. In React hooks, you don't have to use componentDidMount life cycle separately to fetch data. The useEffect has incorporate the React life cycle methods(mounting, updating and unmounting). Let's convert the code we wrote on day 18 to React hooks. We need to import the useEffect from react. The useEffect takes two arguments: callback and an array. If the array is empty it behaves as componentDidMount life cycle where if the array has other properties, it will behave as updating too. ```js import React, { useState, useEffect } from 'react'