Consider a scenario where there are 2 URLs:
website.com/Overview
website.com/Overview/City
When website.com/Overview
is accessed, the component shown is Overview
, while accessing website.com/Overview/City
reveals the City
component.
An issue arises when I need to retrieve data required for both components through a GET request. Currently, I perform this request within the mounted() lifecycle hook of each individual component. However, I am contemplating if it is possible to carry out the GET request just once in the parent Overview component and then pass the obtained information down to City as props, thus eliminating the need for an additional GET request.
My concern is what happens if a user directly enters website.com/Overview/City
? Given that the GET request is made during the mounting of the Overview component and hasn't been executed because the user directly navigated to the URL leading to the City component, will the response still be available in the child component?