Skip to content

Instantly share code, notes, and snippets.

@i-oliva
Created April 14, 2018 08:40
Show Gist options
  • Save i-oliva/f751fc5caa6fab9b72d6f3e1e03f883a to your computer and use it in GitHub Desktop.
Save i-oliva/f751fc5caa6fab9b72d6f3e1e03f883a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/jenuru
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<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>
</head>
<body>
<main id="content"></main>
<script id="jsbin-javascript">
/**
My first component in React
*/
class MyFirstComponent extends React.Component {
/**
We render the view
*/
render() {
// JSX Syntax
return React.createElement("h1", null, "Hello World");
}
}
//NowweneedtomounttheentireapplicationinanHTMLnode,
//forthatweobtainsaidnode
var node = document.getElementById("content");
//ReactDOMisthelibrarythatrendersourapplicationinHTML.
ReactDOM.render(React.createElement(MyFirstComponent, null), node);
// Voila!
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<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>
</head>
<body>
<main id="content"></main>
</body>
</html>
</script>
<script id="jsbin-source-javascript" type="text/javascript">/**
My first component in React
*/
class MyFirstComponent extends React.Component {
/**
We render the view
*/
render() {
// JSX Syntax
return <h1>Hello World</h1>;
}
}
//NowweneedtomounttheentireapplicationinanHTMLnode,
//forthatweobtainsaidnode
var node = document.getElementById("content");
//ReactDOMisthelibrarythatrendersourapplicationinHTML.
ReactDOM.render(<MyFirstComponent />, node);
// Voila!</script></body>
</html>
/**
My first component in React
*/
class MyFirstComponent extends React.Component {
/**
We render the view
*/
render() {
// JSX Syntax
return React.createElement("h1", null, "Hello World");
}
}
//NowweneedtomounttheentireapplicationinanHTMLnode,
//forthatweobtainsaidnode
var node = document.getElementById("content");
//ReactDOMisthelibrarythatrendersourapplicationinHTML.
ReactDOM.render(React.createElement(MyFirstComponent, null), node);
// Voila!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment