Skip to content

Instantly share code, notes, and snippets.

@trey
Last active September 15, 2016 02:06
Show Gist options
  • Save trey/143934a45797af84c231 to your computer and use it in GitHub Desktop.
Save trey/143934a45797af84c231 to your computer and use it in GitHub Desktop.
Icon React Component

Icon React Component

For use with this setup.

Use:

<Icon shape="edit" />
import React from 'react';
const Icon = React.createClass({
render () {
const shape = this.props.shape;
const sprite = '/public/img/sprites.svg';
return <svg><use xlinkHref={`${sprite}#shape-${shape}`} /></svg>;
}
});
module.exports = Icon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment