Skip to content

Instantly share code, notes, and snippets.

@lricoy
Last active February 7, 2018 16:02
Show Gist options
  • Save lricoy/a9cfcc64f4053d198425c73782f01452 to your computer and use it in GitHub Desktop.
Save lricoy/a9cfcc64f4053d198425c73782f01452 to your computer and use it in GitHub Desktop.
React createElement without JSX
<!DOCTYPE html>
<html>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<body>
<div id="myApp"></div>
<script type="text/javascript">
const rootElement = document.getElementById('myApp')
const message = React.createElement(
'span',
{ className: 'stylish-message' },
'React sem JSX'
)
ReactDOM.render(message, rootElement)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment