Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created May 16, 2019 19:02
Show Gist options
  • Save luisenriquecorona/92609cbe85a2f22720d34d60569d2633 to your computer and use it in GitHub Desktop.
Save luisenriquecorona/92609cbe85a2f22720d34d60569d2633 to your computer and use it in GitHub Desktop.
A component that we created using createClass () does not produce any output. We will have to use the component so that we can actually see it working on the page. This part requires the other piece of React we need to operate: React-DOM.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test React from a blank page</title>
</head>
<body>
<div id="anchorage"></div>
<script src="https://unpkg.com/[email protected]/dist/react.js"></script>
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script>
<script src="https://unpkg.com/[email protected]/browser.min.js"></script>
<script type="text/babel">
var MyComponent = React.createClass({
render: function() {
return (
<div>
<h1>component with createClass()</h1>
<p>This React component I believe as a simple test.
I do it with CreateClass because I want to focus on ES5</p>
</div>
);
}
});
ReactDOM.render(
<div>
<MyComponent />
<MyComponent />
</div>,
anchorage
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment