{"id":15506251,"url":"https://github.com/fi3ework/mova","last_synced_at":"2026-06-20T09:31:10.798Z","repository":{"id":66226774,"uuid":"165516814","full_name":"fi3ework/mova","owner":"fi3ework","description":"[WIP] more easy and better way to play with MobX","archived":false,"fork":false,"pushed_at":"2019-01-25T03:51:12.000Z","size":317,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T19:58:26.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fi3ework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-13T14:45:04.000Z","updated_at":"2019-08-01T08:21:26.000Z","dependencies_parsed_at":"2023-03-21T20:18:03.686Z","dependency_job_id":null,"html_url":"https://github.com/fi3ework/mova","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"52704044c1163890765af5d80c0bcc262a93850d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fi3ework/mova","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fi3ework%2Fmova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fi3ework%2Fmova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fi3ework%2Fmova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fi3ework%2Fmova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fi3ework","download_url":"https://codeload.github.com/fi3ework/mova/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fi3ework%2Fmova/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34565238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:26:27.937Z","updated_at":"2026-06-20T09:31:10.783Z","avatar_url":"https://github.com/fi3ework.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"An enhanced version of **react-router-v4 Route** Component that keeps route component alive on unmatched path and restore it completely on match path.\n\n## Document\n\n[中文](./docs/README-zh.md)\n\n## Demo\n\n### codeSandbox\n\nYou can experience and review the source code on codeSandbox.\n\n[![Edit react-live-route-demo-1](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/yj9j33pw4j)\n\n### QR code\n\nYou also can scan the QR code of the demo above to experience it on mobile device.\n\n![qr](./docs/qr.png)\n\n## Install\n\n```bash\nnpm install react-live-route\n```\n\nor\n\n```bash\nyarn add react-live-route\n```\n\n## About\n\nIt will hide component of route instead of unmout it when the path is not match and restore it when come back. There are a few APIs provided to control the hidden condition of component.\n\nExample：\n\nThere is a item list page, click on the items on this page will enter the item detail page. When entering the detail page, item list page will be hidden and it will keep hidden when you are on item detail page. Once back to the list page, the list page will be restored to the last state of leaving.\n\n## Features\n\n- ✅ Fully compatible with react-router-v4, all passed the react-router-v4 unit tests.\n- 🎯 Completely restored to the state of the last time you left (scroll position included).\n- 🔒 Minimally invasive, all you need to do is import LiveRoute.\n- ✌️ Super easy API.\n\n## Caveat ⚠️\n\n- LiveRoute **SHOULD NOT** be wrapped by `Switch` directly, cause `Switch` only render the first matched child element so that LiveRoute may be skipped directly. You can move LiveRoute from `Switch` to the outside.\n- If LiveRoute's parent route is unmounted on current location, then it will also 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 or stop nestting the router.\n- In some cases the DOM of LiveRoute will be modified directly and the scroll position will not change when navigation. This is not a problem with react-live-route. You can scroll the screen to the top manually and you may get some help from [this article](https://github.com/ReactTraining/react-router/blob/2b94b8f9e115bec6426be06b309b6963f4a96004/packages/react-router-dom/docs/guides/scroll-restoration.md) from react-router. By the way, if the scroll position will be restored by LiveRoute, it will come up after the scroll operation in componet of LiveRoute due to the render order of React.\n\n## Usage\n\n### livePath: string or array\n\n`livePath` is the path you want to hide the component instead of unmount it. The specific rules of `livePath` are the same as `path` props of Route in react-router-v4. You still can use `component` or `render` props to render a component.\n\n`livePath` also can accept an array of string above since 1.2.0. `livePath` is matched if any string in the array is matched.\n\nLiveRoute will re-render when it come back from a `path` matching location from the `livePath` matching location. It will unmount on other unmatched locations.\n\nExample:\n\nThe route of List will be rendered normally under `/list`, and it will be hidden when location change to `/user/:id`, and it will be unmounted normally when entering  other locations.\n\n```jsx\nimport LiveRoute from 'react-live-route'\n\n\u003cLiveRoute path=\"/list\" livePath=\"/user/:id\" component={List} /\u003e\n```\n\n### alwaysLive: bool\n\n`alwaysLive` is just like `livePath`. The difference is the component will not be unmount on **any other location** after the it's first mount. \n\nExample: \n\nAfter the first mount on match location, the Modal page will be hidden when the path is not matched, and will re-render when `path` match again.\n\n```jsx\nimport LiveRoute from 'react-live-route'\n\n\u003cLiveRoute path=\"/list\" alwaysLive={true} component={Modal}/\u003e\n```\n\n### onHide: (routeState: {location, livePath, alwaysLive}) =\u003e any\n\nThis hook will be triggered when LiveRoute will hide in `componentWillReceiveProps` stage (so it happens before re-render). \n\n### onReappear: (routeState: {location, livePath, alwaysLive}) =\u003e any\n\nThis hook will be triggered when LiveRoute will reappear from hide in `componentWillReceiveProps` stage (so it happens before re-render). \n\n## TODO\n\n- [ ] add test case\n- [ ] add forceUnmount prop\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffi3ework%2Fmova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffi3ework%2Fmova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffi3ework%2Fmova/lists"}