{"id":15678867,"url":"https://github.com/jaredly/react-teleporter","last_synced_at":"2025-05-07T09:01:31.069Z","repository":{"id":32740526,"uuid":"36330990","full_name":"jaredly/react-teleporter","owner":"jaredly","description":"Make teleportable components","archived":false,"fork":false,"pushed_at":"2019-03-25T13:59:49.000Z","size":3578,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T08:21:30.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredly.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-26T23:51:18.000Z","updated_at":"2025-01-27T10:50:06.000Z","dependencies_parsed_at":"2022-07-24T18:00:06.626Z","dependency_job_id":null,"html_url":"https://github.com/jaredly/react-teleporter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freact-teleporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freact-teleporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freact-teleporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredly%2Freact-teleporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredly","download_url":"https://codeload.github.com/jaredly/react-teleporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252847477,"owners_count":21813451,"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":[],"created_at":"2024-10-03T16:25:13.215Z","updated_at":"2025-05-07T09:01:30.995Z","avatar_url":"https://github.com/jaredly.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# teleporter\n\nTeleport components around the tree without losing state or destroying the\nDOM!\n\n[some context/discussion in this gist](https://gist.github.com/chenglou/34b155691a6f58091953)\n\n```javascript\nimport {teleportable, teleparent} from 'react-teleport'\n```\n\n## Examples\n\n### [Basic Grid](docs/grid.mov)\n\n[read the source](./example.js), interesing lines identified with `/***\\ \u003c---- \\***/`\n\n(click image for .mov)\n\n[![grid](docs/grid.gif)](docs/grid.mov)\n\n### [Photo list](docs/photojump.mov)\n\n[read the source](./photojump.js), interesing lines identified with `/***\\ \u003c---- \\***/`\n\n(click image for .mov)\n\n[![image](docs/photojump.gif)](docs/photojump.mov)\n\n## API\n\n### `@teleportable`\n\n```javascript\n/*\n * This function is best used as a decorator, and it makes a component \"teleportable\".\n *\n * A teleportable component can be moved between parents, nodes, etc. without\n * losing state, and without losing the DOM tree.\n *\n * Props:\n * - telekey: a teleport key. `teleparents` can create teleport keys.\n *\n * When the `teleparent` that created a telekey is garbage collected\n * (unmounted from the dom), then this teleportable component will also be\n * unmounted, but *not until then*.\n *\n * So if you have a long-lived teleparent with lots of teleportable children,\n * you could end up with a fair amount of garbage.\n */\n```\n\n### `@teleparent`\n\n```javascript\n/**\n * Also a @decorator. Makes a component into a `teleparent`.\n *\n * Teleparents can create telekeys (the unique ids used to manage teleportable\n * components), via two functions, given as props:\n *\n * - makeTelekey() -\u003e a new telekey\n * - getTelekey(id) -\u003e get (or create if needed) the telekey corresponding to\n *   some id\n *\n * If you only have one or two teleportable components, then `makeTelekey`\n * probably makes the most sense.\n *\n * If you have a bunch of components that need to be teleportable, that are\n * identified by some string id already, you can use `getTelekey(id)` to\n * always get the same `telekey` for a given `id`.\n *\n * See `photojump.js` for an example of using `getTelekey`, and `example.js`\n * for a simple example of using `makeTelekey`.\n */\n ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredly%2Freact-teleporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredly%2Freact-teleporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredly%2Freact-teleporter/lists"}