createClass.html

<!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/react@15.3.2/dist/react.js"></script> <script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.js"></script> <script src="https://unpkg.com/babel-core@5.8.38/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>
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.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.