Created
April 9, 2018 09:23
-
-
Save toledox82/ec99f07ca8c349890accec50f35fc6d1 to your computer and use it in GitHub Desktop.
React Element, Stateless Component, Stateful Component
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
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
// Element | |
const Elemento = <h1>Hello World!</h1> | |
// Functional Stateless Component | |
const Component1 = (props) => { | |
return <span>{props.name}</span> | |
} | |
// Stateful | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h1 className="App-title">Welcome to React</h1> | |
</header> | |
<p className="App-intro"> | |
<Component1 name="Marcio" />, to get started, edit <code>src/App.js</code> and save to reload. | |
</p> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment