React-router: Allow caching and reuse of rendered components without remounting/re-rendering again

Created on 2 Jun 2017  路  2Comments  路  Source: ReactTraining/react-router

When a loading a route requires heavy duty rendering it is sometimes best to just cache it and retuse the same component, like in tabs.

Allow caching the component and use hide/show instead of mount/unmount when returning to same route with the same params (if any).

Proposed sample code:

<Route path="/about" cached={true} component={About}/>

Where cached can be boolean or function that accepts the same parameters as render and return whether to cache (hide and show instead on mount/unmount).

All 2 comments

Please don't open duplicate issues: #5195

@timdorr you closed that issue without so much as addressing it though, using a boilerplate response.

Was this page helpful?
0 / 5 - 0 ratings