I have a scenario where I fetch vehicle details from the backend in one component (ValuationComponent). Once the data is fetched, I need to use the same data in another component (OtherComponent) for various operations.
Instead of making a separate API call in OtherComponent, I'm considering using a shared service to store the fetched data from ValuationComponent and retrieve it in OtherComponent. This way, I can avoid duplicate API calls and ensure consistent data across components.
Is this approach considered a good practice? Are there any potential drawbacks or alternative solutions I should consider?
In my scenario, I have successfully fetched vehicle details from the backend in the ValuationComponent using an API call. The fetched data is stored in a local variable within the component.
In the Other Component, I want to access the same vehicle details without making an additional API call. To achieve this, I'm considering using a shared service that holds the fetched data. This way, I can simply retrieve the data from the shared service in Other Component.