Created
February 17, 2019 20:48
-
-
Save Saifadin/5b4f3f16d5a3fbbeedaafcc19200e11a to your computer and use it in GitHub Desktop.
Inline React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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