It can keeps component of route hidden (alive) instead of unmout when the path is not match. There are a few APIs provided to control the life cycle of component.
We have a list page, click on the items in the list page will enter the details page, when entering the details page, the list page will be hidden, when returning to the list page, the list page will revert to the last time you left.
## Features
-完全兼容 react-router-4
-侵入性极小,只需引入一个 LiveRoute
-完全恢复上一次离开页面时的模样
-超简单的 API
-✅ Fully compatible with react-router-4, all passed the react-router-v4 unit tests.
-📦 Completely restored the last time you left the page (scroll position included).
-🎯 Minimally invasive, all you need to do is importing a LiveRoute.
-✌️ Blazing easy API.
## Usage
## API
### livePath
LiveRoute 需要隐藏的页面的路由,规则与 react-router 的 path 一样。
`livePath` is the path of the page that needs to be hidden. The specific rules are the same as `path` props of Route in react-router-v4.
Example:
The route of List will be rendered normally under `/list`, and it will be hidden when entering `/user/:id`, and it will be unmounted normally when entering other pages.
- If a route uses LiveRoute and the parent route of the current route is unmounted, then whether or not the LiveRoute is the current matching livePath will be unmounted. This is determined by the top-down design principle of React. You can use LiveRoute to declares a parent route to solve this problem.