I have array initial value is like empty, in fetch function i am updating filterData array with data but outside of fetchData scope it's not updating filterData it's still empty
 // Fetching Data and updating states
    let filterData = []
    const fetchData = async () => {
    const req = await fetch(
         "https://stratic-research-institute.firebaseio.com/articles.json"
          );
    let loaded = [];
    const res = await req.json();
    const vl = Object.keys(res);
    vl.map((item) => loaded.push(res[item]));
    setposts({
    arData: loaded.reverse(),
    loading: false,
   });
   filterData = loaded;
};
 console.log(filterData)
 
     
     
    