rstacruz/remount
소개
커스텀 요소를 사용해 React 컴포넌트를 DOM에 마운트합니다.
웹 및 앱 개발What you can do
- JSON props (eg, <x-greeter props-json="{...}">) (docs)
- Named attributes (eg, <x-greeter name="John">) (docs)
- Uses Custom Elements API (when available)
- Fallback to compatible API for other browers
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalRemount
Use your React components anywhere in your
HTML as web components (custom elements).
Demo ⚡ Docs
2kb gzip'd · No dependencies · IE support
Installation
Remount is available through the npm package repository. React 18 is required.
# npm
npm install remount react react-dom
# yarn
yarn add remount react react-dom
- Via yarn:
yarn add remount - or npm:
npm install remount
Usage
Let's start with any React component. Here's one:
const Greeter = ({ name }) => {
return <div>Hello, {name}!</div>
}
Use define() to define custom elements. Let's define a <x-greeter> element:
import { define } from 'remount'
define({ 'x-greeter': Greeter })
You can now use it anywhere in your HTML! :boom:
<x-greeter props-json='{"name":"John"}'></x-greeter>
Use cases
Some ideas on why you might want to consider Remount for your project:
![]() |
✨ Adding React to non-SPA apps You can use React components on any page of a "regular" HTML site. Great for adding React to apps built on Rails or Phoenix. |
![]() |
💞 Interop with other frameworks Remount lets you use your React components just like any other HTML element. This means you can use React with Vue, Angular, or any other DOM library/framework. |
More features
- JSON props (eg,
<x-greeter props-json="{...}">) (docs) - Named attributes (eg,
<x-greeter name="John">) (docs) - Uses Custom Elements API (when available)
- Fallback to compatible API for other browers
- Shadow DOM mode (when available)
Browser support
Remount supports all browsers that React 18 supports.
Custom Elements API# ("Web Components") will be used if it's available (Chrome/67+), and will fallback to a compatible API otherwise.
Documentation
- API documentation
- Builds — ES2015+ and ES Module builds are also provided.
- FAQ and Troubleshooting — Start here if you find any issues.
- Comparison with alternatives
- Browser support
Thanks
remount © 2022, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz
관련 프로젝트 살펴보기
불러오는 중…


