How to handle multiple caches for the same route
masterBy default, multiple <KeepAlive> components at the same position under the same parent will share the same cache. This is problematic for routes with parameters (e.g., /item/1 and /item/2) where you want each ID to have its own unique cache.
To solve this, use the id prop to differentiate caches based on a unique identifier.
<Route
path="/item/:id"
render={props => (
<KeepAlive id={props.match.params.id}>
<Item {...props} />
</KeepAlive>
)}
/><Route
path="/item/:id"
render={props => (
<KeepAlive id={props.match.params.id}>
<Item {...props} />
</KeepAlive>
)}
/>