Last active
April 12, 2018 07:50
-
-
Save jonleopard/71cf25a092c7ee9ba0821d4a9b4c3ad9 to your computer and use it in GitHub Desktop.
This file contains 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
// // | |
// Notes on React.js // | |
// // | |
// ES6 Arrow Function | |
// This is a functional component | |
const App = () => { | |
return <h1>Hello World</h1> | |
}; | |
const App = () => { | |
// Put variables on top. | |
const title = "Hello world"; | |
const subhead = "This is the subhead." | |
return ( | |
// To render more than one div, you must wrap in a parent dev | |
<div> | |
<h1 className="styled_h1">{title}</h1> | |
<p classname="styled_paragraph">I am rendering two elements to the page! {subhead}</p> | |
</div> | |
); | |
} | |
// ES5 (Old way, same output) | |
function App() { | |
return <h1>Hello world</h1> | |
}; | |
// ES6 Class | |
class App extends React.Component { | |
render() { | |
return <h1>Hello World</h1> | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment