React: Export Module

Sometimes we need exportable modules for use through our applications. It is pretty straight forward to export a module.

NPM Installs:

npm install create-react-class --save
npm install prop-types --save
npm install react --save
npm install react-dom --save

Export:

 module.exports = {exportedModuleName:ModuleName};

exportedModuleName is the name that you use in other pages.
ModuleName is the name of the module to export.

The module will look something like this.
This one is just a TD module. But really you can do anything you want.

window.jQuery = window.$ = require("jquery"); 
import React from "react"; 
import ReactDOM from "react-dom";
var createReactClass = require('create-react-class');
var propTypes = require('prop-types');

var MyExportableModule = createReactClass({
      render: function() {
            return React.createElement("anyelement", {className: this.props.className, key: this.props.name}, this.props.fields);
      }
});

MyExportableModule.PropTypes = {
      name: React.PropTypes.string.isRequired,
      fields: React.PropTypes.array.isRequired,
      className: React.PropTypes.string
};