JSFiddle - React, Tailwind, and code Playground

by mckabue

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
<div id="root">

</div>

JavaScript

requirejs.config({
	paths: {
        'react': 'https://unpkg.com/[email protected]/dist/react',
        'react-dom': 'https://unpkg.com/[email protected]/dist/react-dom',
        'html-react-parser': 'https://unpkg.com/html-react-parser@latest/dist/html-react-parser.min'
    }
});

define('templateloader', function(){
		return {
        load: function (name, req, onload, config) {
            //req has the same API as require().
            req([name, 'html-react-parser'], function (html, Parser) {
                onload(Parser(html));
            });
        }
    };
});

define('template.html', function(){
		return '<b>Hello, AMD! <br/> wow</b>';
});

requirejs(['react-dom', 'templateloader!template.html'], function(ReactDOM, template) {
	console.log(template);
	ReactDOM.render(template, document.getElementById('root'));
});