Created
May 8, 2016 13:23
-
-
Save joshwcomeau/7d45fd873a6a1201346961e1d755c1b7 to your computer and use it in GitHub Desktop.
letter-animation
This file contains hidden or 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 random from 'lodash/random'; | |
import sampleSize from 'lodash/sampleSize'; | |
import FlipMove from 'react-flip-move'; | |
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); | |
function getSubsetOfAlphabet() { ... } | |
class LetterDemo extends Component { | |
constructor(props) { ... } | |
componentWillMount() { ... } | |
componentWillUnmount() { ... } | |
renderLetters() { | |
return this.state.letters.map(letter => ( | |
<span key={letter} style={{display: 'inline-block'}}> | |
{letter} | |
</span> | |
)) | |
} | |
render() { | |
return ( | |
<div className="letter-demo"> | |
<FlipMove> | |
{this.renderLetters()} | |
</FlipMove> | |
</div> | |
); | |
} | |
} | |
export default LetterDemo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment