Skip to content

Instantly share code, notes, and snippets.

@joshwcomeau
Created May 8, 2016 13:23
Show Gist options
  • Save joshwcomeau/7d45fd873a6a1201346961e1d755c1b7 to your computer and use it in GitHub Desktop.
Save joshwcomeau/7d45fd873a6a1201346961e1d755c1b7 to your computer and use it in GitHub Desktop.
letter-animation
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