Created
November 3, 2018 18:42
-
-
Save mtheoryx/7ecac5b2f2819be84ceb15cb9288380f to your computer and use it in GitHub Desktop.
react.html
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>React Demo</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <!-- <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> --> | |
| <!-- <script src="main.js"></script> --> | |
| <style media="screen"> | |
| .messageBox { | |
| border: 1px solid; | |
| margin: 1em; | |
| padding: 2em; | |
| } | |
| .error { | |
| border-color: red; | |
| background-color: #eebbbb; | |
| } | |
| .success { | |
| border-color: blue; | |
| background-color: #bbeebb; | |
| } | |
| .hidden { | |
| display: none; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <main id="content"></main> | |
| <script type="text/javascript" src="https://unpkg.com/[email protected]/babel.js"></script> | |
| <script type="text/javascript" src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script> | |
| <script type="text/javascript" src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script> | |
| <script type="text/babel" data-presets="react"> | |
| class NameInput extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| <label for="name">Name: | |
| <input type="text" id="name" placeholder="Enter Your Name"/> | |
| </label> | |
| <button id="submit_info">Click me!</button> | |
| <MessageBox /> | |
| </div> | |
| ); | |
| }; | |
| } | |
| class MessageBox extends React.Component { | |
| render() { | |
| return ( | |
| <div className="messageBox error"> | |
| This is the message | |
| </div> | |
| ); | |
| }; | |
| }; | |
| ReactDOM.render(<NameInput />, document.getElementById('content')); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment