Skip to content

Instantly share code, notes, and snippets.

@appwebtech
Last active March 13, 2019 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appwebtech/0ee7707af647bcd79e1c9170b0c3eb8e to your computer and use it in GitHub Desktop.
Save appwebtech/0ee7707af647bcd79e1c9170b0c3eb8e to your computer and use it in GitHub Desktop.
// source https://jsbin.com
<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>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
import React from 'react';
import ReactDOM from 'react-dom';
// Props are ideal as they pass data from Parent to Child components and they are accessed by injection
const Welcome = ((props) =>
React.createElement("div", null,
React.createElement("h4", null, "Welcome to my homepage."),
React.createElement("p", null, "My names are Mr. ", props.firstName, " ", props.lastName, ".")
)
)
const App = (() => {
return (
React.createElement("div", null,
React.createElement(Welcome, {firstName: "Joe", lastName: "Doe"}),
React.createElement(Welcome, {firstName: "Jane", lastName: "Doe"})
)
)
});
ReactDOM.render(
React.createElement(App, null),
document.getElementById('app')
);
</script>
<script id="jsbin-source-javascript" type="text/javascript">import React from 'react';
import ReactDOM from 'react-dom';
// Props are ideal as they pass data from Parent to Child components and they are accessed by injection
const Welcome = ((props) =>
<div>
<h4>Welcome to my homepage.</h4>
<p>My names are Mr. {props.firstName} {props.lastName}.</p>
</div>
)
const App = (() => {
return (
<div>
<Welcome firstName="Joe" lastName="Doe"/>
<Welcome firstName="Jane" lastName="Doe"/>
</div>
)
});
ReactDOM.render(
<App/>,
document.getElementById('app')
);</script></body>
</html>
import React from 'react';
import ReactDOM from 'react-dom';
// Props are ideal as they pass data from Parent to Child components and they are accessed by injection
const Welcome = ((props) =>
React.createElement("div", null,
React.createElement("h4", null, "Welcome to my homepage."),
React.createElement("p", null, "My names are Mr. ", props.firstName, " ", props.lastName, ".")
)
)
const App = (() => {
return (
React.createElement("div", null,
React.createElement(Welcome, {firstName: "Joe", lastName: "Doe"}),
React.createElement(Welcome, {firstName: "Jane", lastName: "Doe"})
)
)
});
ReactDOM.render(
React.createElement(App, null),
document.getElementById('app')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment