{"id":17698569,"url":"https://github.com/iamogbz/react-mirror","last_synced_at":"2025-04-30T07:49:44.621Z","repository":{"id":37820716,"uuid":"248657088","full_name":"iamogbz/react-mirror","owner":"iamogbz","description":"🪞 Create synchronized replicas of a DOM element using React","archived":false,"fork":false,"pushed_at":"2025-04-29T10:47:19.000Z","size":79832,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T07:49:36.452Z","etag":null,"topics":["mirror","portal","react","react-dom","react-mirror","react-portal"],"latest_commit_sha":null,"homepage":"http://ogbizi.com/react-mirror/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamogbz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["iamogbz"]}},"created_at":"2020-03-20T03:10:45.000Z","updated_at":"2025-04-29T10:47:22.000Z","dependencies_parsed_at":"2023-10-25T12:02:37.423Z","dependency_job_id":"c9081b37-b103-41d3-8c6a-4001554eddca","html_url":"https://github.com/iamogbz/react-mirror","commit_stats":{"total_commits":765,"total_committers":4,"mean_commits":191.25,"dds":0.3555555555555555,"last_synced_commit":"f5d8b10c4c91992144cafe1d07c11f6c01cff9fc"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":"iamogbz/node-js-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamogbz%2Freact-mirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamogbz%2Freact-mirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamogbz%2Freact-mirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamogbz%2Freact-mirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamogbz","download_url":"https://codeload.github.com/iamogbz/react-mirror/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666226,"owners_count":21624290,"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":["mirror","portal","react","react-dom","react-mirror","react-portal"],"created_at":"2024-10-24T15:10:10.318Z","updated_at":"2025-04-30T07:49:44.594Z","avatar_url":"https://github.com/iamogbz.png","language":"TypeScript","funding_links":["https://github.com/sponsors/iamogbz"],"categories":[],"sub_categories":[],"readme":"# React Mirror\n\n\u003cspan\u003e\u003cimg alt=\"⚛️\" align=\"right\" width=\"144\" height=\"144\" src=\"https://github.com/iamogbz/react-mirror/raw/main/assets/logo.png\"/\u003e\u003c/span\u003e\n\n[![NPM badge](https://img.shields.io/npm/v/react-mirror)](https://www.npmjs.com/package/react-mirror)\n[![Dependabot badge](https://badgen.net/github/dependabot/iamogbz/react-mirror/?icon=dependabot)](https://app.dependabot.com)\n[![Dependencies](https://img.shields.io/librariesio/github/iamogbz/react-mirror)](https://libraries.io/github/iamogbz/react-mirror)\n[![Build Status](https://github.com/iamogbz/react-mirror/workflows/Build/badge.svg)](https://github.com/iamogbz/react-mirror/actions)\n[![Coverage Status](https://coveralls.io/repos/github/iamogbz/react-mirror/badge.svg?branch=refs/heads/main)](https://coveralls.io/github/iamogbz/react-mirror)\n\nCreate synchronized replicas of a React DOM element\n\n\u003e Suggested alternative for non react usage [mirror-element](https://github.com/iamogbz/oh-my-wcs/blob/main/components/el-mirror.md)\n\n## Usage\n\nSee equivalent uses of the hook and component below.\n\n### `useMirror` hook\n\n```jsx\nimport { useMirror } from 'react-mirror';\n\nfunction App() {\n  const [ref, mirror] = useMirror({ className: 'mirror-frame' });\n  return (\n    \u003c\u003e\n      \u003cdiv ref={ref} /\u003e\n      {mirror}\n    \u003c/\u003e\n  );\n}\n```\n\n### `\u003cMirror /\u003e` component\n\n```jsx\nimport React from 'react';\nimport { Mirror } from 'react-mirror';\n\nfunction App() {\n  const [reflect, setReflect] = React.useState(null);\n  return (\n    \u003c\u003e\n      \u003cdiv ref={setReflect} /\u003e\n      \u003cMirror reflect={reflect} className='mirror-frame' /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n### `\u003cWindow /\u003e` component\n\nYou can also render a reflection, with all the styles needed, in a separate window using the magic of [`Portals`](https://reactjs.org/docs/portals.html) 🌀\n\n```jsx\nimport React from 'react';\nimport { FrameStyles, Reflection, Window } from 'react-mirror';\n\nfunction App() {\n  const [reflect, setReflect] = React.useState(null);\n  return (\n    \u003c\u003e\n      \u003cdiv ref={setReflect} /\u003e\n      \u003cWindow\u003e\n        \u003cFrameStyles /\u003e\n        \u003cReflection real={reflect} style={{ pointerEvents: \"none\" }} /\u003e\n      \u003c/Window\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n## Demos\n\n### Using Portals\n\n- [Live Preview](https://ogbizi.com/react-mirror/) ([source](demo))\n\n## Alternatives\n\n- Simple HTML custom [mirror-element](https://github.com/iamogbz/oh-my-wcs/blob/main/components/el-mirror.md)\n- [Curious case of independent genesis](https://github.com/Theadd/react-mirror#readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamogbz%2Freact-mirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamogbz%2Freact-mirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamogbz%2Freact-mirror/lists"}