Skip to content
Snippets Groups Projects
Commit 754f05b7 authored by Tom Robinson's avatar Tom Robinson
Browse files

Demonstrate converting a React component to ES6 class (supported in 0.13)

parent adb22fc5
Branches
Tags
No related merge requests found
......@@ -2,15 +2,13 @@
import { loadIcon } from 'metabase/icon_paths';
export default React.createClass({
displayName: 'Icon',
render: function () {
export default class Icon extends React.Component {
render() {
var icon = loadIcon(this.props.name);
if (icon.svg) {
return (<svg {... icon.attrs} {... this.props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>);
} else {
return (<svg {... icon.attrs} {... this.props}><path d={icon.path} /></svg>);
}
}
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment