{"id":19904386,"url":"https://github.com/alloc/react-scenic","last_synced_at":"2025-05-03T00:31:38.149Z","repository":{"id":66178247,"uuid":"200382713","full_name":"alloc/react-scenic","owner":"alloc","description":"(WIP) Experimental router for React Native","archived":true,"fork":false,"pushed_at":"2023-10-16T17:31:55.000Z","size":740,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-01T07:27:30.640Z","etag":null,"topics":["react","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/alloc.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-08-03T14:08:12.000Z","updated_at":"2024-11-11T16:57:17.000Z","dependencies_parsed_at":"2024-11-12T20:41:04.629Z","dependency_job_id":null,"html_url":"https://github.com/alloc/react-scenic","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Freact-scenic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Freact-scenic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Freact-scenic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Freact-scenic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/react-scenic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252126559,"owners_count":21698964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["react","react-native"],"created_at":"2024-11-12T20:28:11.147Z","updated_at":"2025-05-03T00:31:38.143Z","avatar_url":"https://github.com/alloc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-scenic\n\nThe best observable router for React. 🌋\n\n## API\n\nThe API is under development. Expect breaking changes and undocumented features.\n\n### Scenic\n\nThe `\u003cScenic\u003e` component decides which scenes are mounted, which scene is focused, and which scenes have been visited.\n\n```tsx\n\u003cScenic\u003e\n  {children}\n\u003c/Scenic\u003e\n```\n\n\u0026nbsp;\n\n### ScenicRoot\n\nThe context of a `\u003cScenic\u003e` component. It tracks the current scene as well as past scenes. Its properties can be used in a `withAuto` component (eg: to render elements conditionally).\n\n\u0026nbsp;\n\n### useScenic\n\nUse the `ScenicRoot` of the nearest `\u003cScenic\u003e` ancestor.\n\n```ts\nconst scenic = useScenic()\nscenic.visit('/')\n```\n\n\u0026nbsp;\n\n### useScenicRef\n\nConvenience hook for `useRef\u003cScenicRoot\u003e(null)`\n\nUseful in the parent that renders a `\u003cScenic\u003e` component.\n\n```tsx\nconst scenicRef = useScenicRef()\nconst rootElement = \u003cScenic ref={scenicRef}\u003e{scenes}\u003c/Scenic\u003e\n\nuseEffect(() =\u003e {\n  scenicRef.current.visit('/foo')\n})\n```\n\n\u0026nbsp;\n\n### useScene\n\nUse the `Scene` of the nearest `\u003cSceneMatch\u003e` ancestor.\n\n```ts\nconst scene = useScene()\n```\n\nOr get the `Scene` for a path, creating one if necessary:\n\n```ts\nconst scene = useScene(path)\n```\n\n\u0026nbsp;\n\n### Scene\n\nScenes are used to conditionally render elements based on the current path (or the history of paths) of the nearest `\u003cScenic\u003e` component ancestor. Its properties can be observed by any `withAuto` component.\n\nTo create a `Scene`, you can call `ScenicRoot#get` or the `useScene` hook.\n\n```ts\nconst scene = useScene('/')\n// ..same as..\nconst scenic = useScenic()\nconst scene = scenic.get('/')\n```\n\nBoth calls are idempotent, meaning they will always return the same `Scene` if you ever pass the same path multiple times.\n\n\u0026nbsp;\n\n### SceneMatch\n\nRender children if a given `path` or `scene` is mounted.\n\n```tsx\n// with a path:\n\u003cSceneMatch path=\"/\"\u003e\n  {children}\n\u003c/SceneMatch\u003e\n\n// or with a Scene object:\n\u003cSceneMatch scene={scene}\u003e\n  {children}\n\u003c/SceneMatch\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Freact-scenic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Freact-scenic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Freact-scenic/lists"}