Skip to content

Instantly share code, notes, and snippets.

@Saifadin
Created February 17, 2019 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Saifadin/5b4f3f16d5a3fbbeedaafcc19200e11a to your computer and use it in GitHub Desktop.
Save Saifadin/5b4f3f16d5a3fbbeedaafcc19200e11a to your computer and use it in GitHub Desktop.
Inline React
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script>
const e = React.createElement;
function SliderImage() {
return e('div', { className: 'tSlider--image-wrapper' }, e('img', { src: '//cdn.shopify.com/s/files/1/0116/9562/0160/t/3/assets/bg.png?7092974999273233205', className: 'tSlider--image' }));
};
function Text() {
return e(
'div',
{ className: 'tSlider--sliderText' },
e('h1', { className: 'tSlider--headline' }, 'Fun stuff'),
e(
'span',
{ className: 'tSlider--subHeadline' },
'This is a React example without any transpiling ',
e('b', null, 'with a bold text'),
'. ❤️'
)
);
};
function TeduschSlider() {
return e(
'div',
{ className: 'tSlider' },
e(SliderImage),
e(Text)
);
}
const domContainer = document.getElementById('slider');
ReactDOM.render(e(TeduschSlider), domContainer);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment