I have a const called mappedFilter.
mappedFilter takes a while to populate. It renders the first time missing some objects, and renders the second time with all the objects
I have a setState for allItems for (mappedFilter), but it is grabbing the mappedFilter the first time around with missing objects, not once the mappedFilter has gotten done populating with all the fields.
My code:
useEffect(() => {
console.log("mapp", _mappedFilter);
setAllItems(_mappedFilter);
}, [_mappedFilter]);
useEffect(() => {
console.log("_allItems ContractContainer", _allItems);
}, [allItems]);
I want allItems to have all the objects from mappedFilter. How can I fix this?