1.1.1 • Published 10 months ago

react-custom-mount v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

react-custom-mount

Mount react components using custom elements

NPM JavaScript Style Guide

Install

npm install --save react-custom-mount

Usage

import {
    registerCustomElement,
    registerCustomElements,
    Components
} from 'react-custom-mount'

const ComponentOne = ({ myAttribute, children }) => {
    return (
        <>
            <p>Hello {myAttribute}</p>
            {children}
        </>
    )
}

const components: Components = {
    'component-one': ComponentOne
}

document.addEventListener('DOMContentLoaded', function () {
    // Register multiple components
    registerCustomElements(componenets)

    // Or one
    registerCustomElement('component-one', ComponentOne)
})
<component-one my-attribute="hello">
    <div>
        <p>From the other side</p>
    </div>
</component-one>

License

MIT © Borhaneddine GUEMIDI, Sofiane DEBBAGH

1.1.1

10 months ago

1.1.0

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago