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
<button onClick={this.openModal}>open modal</button> | |
<Modal> | |
<button onClick={this.closeModal}>Close</button> | |
</Modal> |
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
const imperativeDouble = numbers => { | |
const doubled = [] | |
for (i = 0; i < numbers.length; i++) { | |
doubled.push(numbers[i] * 2) | |
} | |
return doubled; | |
} | |
const declarativeDouble = numbers => numbers.map(n => n * 2) |
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
class Tabs extends React.Component { | |
static propTypes = { | |
data: React.PropTypes.array.isRequired | |
} | |
state = { | |
activeTabIndex: 0 | |
} | |
handleTabClick(activeTabIndex) { |
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
const DATA = [ | |
{ id: 1, name: 'USA', description: 'Land of the Free, Home of the brave' }, | |
{ id: 2, name: 'Brazil', description: 'Sunshine, beaches, and Carnival' }, | |
{ id: 3, name: 'Russia', description: 'World Cup 2018!' } | |
].reverse() |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Exercise: | |
// | |
// - change the contents of the render function and save the file | |
// - see the updates automatically in your browser without refreshing! | |
//////////////////////////////////////////////////////////////////////////////// | |
import React from 'react' | |
import ReactDOM from 'react-dom' | |
function App() { |
NewerOlder