react-auto-mount

1.0.1 • Public • Published

React Auto Mount

A really tiny module to unobtrusively mount your components.

Usage

Throw a div in your template with a data-component attribute.

<div
  data-component='HelloWorld'
  data-props='{"name": "Ray"}'
/>

Then, invoke the reactAutoMount.

import React from 'react';
import reactAutoMount from 'react-auto-mount';
 
const HelloWorld = ({ name }) => (
  <h1>{`Hello ${name}!`}</h1>
);
 
document.addEventListener('DOMContentLoaded', () => {
  reactAutoMount({ HelloWorld });
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i react-auto-mount

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • rzane