useEffect execution help

Hi, iam learning react but come threw a problem , Iam not able to understand execution flow of this app, i put some console logs but still iam not able to understand execution flow. kindly help

thanks in advance

import React,{useState, useEffect} from "react";
import axios from "axios";
let time=1;

const Search = () => {
    const [term, setTerm] = useState("programming");
    const [results, setResults]=useState([]);
    const [debouncedTerm, setDebouncedTerm]=useState(term);
   
console.log("render",time);
time++;
 useEffect(()=>{
     console.log("first useeffect called");
const timerId= setTimeout(()=>{
    console.log("set timeout called");
    setDebouncedTerm(term);
},1000);


return () =>{
    clearTimeout(timerId);
};
 },[term]);






useEffect(()=>{
    console.log("second useeffect called");
 
const search = async () => {
const {data} = await axios.get("https://en.wikipedia.org/w/api.php",{
    params:{
        action:"query",
        list: "search",
        origin: "*",
        format:"json",
        srsearch:debouncedTerm
    }
});

    console.log("set result called");
   setResults(data.query.search);
};

search();

},[debouncedTerm]);

const renderedResults = results.map((result)=>{
    console.log("map executed");
return(
<div key={results.id} className="item">
    <div className="right floated content">
        <a className="ui button"
        href={`https://en.wikipedia.org?curid=${result.pageid}`}
        >Go</a>
    </div>
    <div className="content">
        <div className="header">
            {result.title}
        </div>
        <span dangerouslySetInnerHTML={{__html:result.snippet}}></span>
        
    </div>
</div>
);
});


    return(
        <div>
        <div className="ui form">
            <div className="field">
                <label>Enter Search term</label>
                <input value={term} 
                onChange={(e)=>setTerm(e.target.value)}
                className="input"/>
            </div>
        </div>
        <div className="ui cell list">
            {renderedResults}
        </div>
        </div>
    );
};

export default Search;

you can use console.time to also see a time of the console output.
To understand the flow of the code in this app, obviously you should be aware of how react and hooks work. The basics are, useEffect will run after the component has rendered. useState set functions will cause a component rerender. useEffect hooks also have a dependency array, which limits when the hook should be called. For example the first useEffect hook in the code has the “term” state variable provided as dependency, which means the hook will be called only if that state has been changed. In the hook itself there is a timer of 1s and once that timer runs out, it will call the setDebounceTerm, which is a state change, so the component will rerender. After the rerender, again useEffect hooks will be called, whenever their dependency values changed and cause a component rerender, whenever they change the component state.
The hook with axious.get function will run whenever the “debouncedTerm” state has been changed nad will take a while to execture(as it will wait for the asynch method to run) and again, it produces a state change with setResults, which will trigger a component rerender.

hi, this is the output of console

render 1
first useeffect called
second useeffect called
set timeout called
set result called
render 2
map executed