Skip to content

Instantly share code, notes, and snippets.

Created Jul 24, 2018
What would you like to do?
Tile component
class Tile extends React.Component {
static propTypes = {
src: PropTypes.string.isRequired,
tile: PropTypes.object.isRequired,
state: PropTypes.number.isRequired,
scale: PropTypes.number.isRequired
render() {
const { src, tile, state, scale } = this.props;
const left = tile.width * state;
return (
<Container width={tile.width} height={tile.height} scale={scale}>
<Image src={src} left={left} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment