1.0.1 • Published 8 years ago

react-auto-mount v1.0.1

Weekly downloads
5
License
ISC
Repository
-
Last release
8 years ago

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 });
});