Last active
December 20, 2016 00:39
-
-
Save scottdomes/e282df91443f92dc24345c136fd5e225 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
import React, { Component } from 'react' | |
import './App.css' | |
import ListItem from './ListItem' | |
function arrayGenerator(length) { | |
return Array.apply(null, { length: length }).map(Number.call, Number) | |
} | |
class App extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
multiplier: 1 | |
} | |
} | |
resetMultiplier() { | |
this.setState({ multiplier: 2 }) | |
} | |
render() { | |
return ( | |
<div className="App"> | |
<button onClick={this.resetMultiplier.bind(this)}>Click Me</button> | |
<ul> | |
{ | |
arrayGenerator(5000).map(i => { | |
return <ListItem key={i} text={i}/> | |
}) | |
} | |
{ | |
arrayGenerator(5000).map(i => { | |
return <ListItem key={i} text={i + this.state.multiplier}/> | |
}) | |
} | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default App |
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' | |
export default class ListItem extends Component { | |
render() { | |
let { text } = this.props | |
return <li>{text}</li> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment