I have 2 screens in Stack Navigator.
All Categories, Add a new category
In the All Categories screen, all categories are displayed.
useEffect(() => {
loadCategories();
}, []);
This is the useEffect
hook that load all the categories.
I have made a touchable opacity to navigate to Add a new category screen, So users can easily add a new category if needed.
What I'm expecting to do: So after adding a new category and going back to the All Categories screen loadCategories()
should run again, So the user can see the newly added category there. But the problem is when I add a new category and go back the loadCategories()
function doesn't execute again. What will be the cause for this?