Skip to content

Instantly share code, notes, and snippets.

@wellyal
Last active October 31, 2018 16:42
Show Gist options
  • Save wellyal/3ffef5ac6a395c56ed254878234d97af to your computer and use it in GitHub Desktop.
Save wellyal/3ffef5ac6a395c56ed254878234d97af to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
class ElmComponent extends Component {
shouldComponentUpdate(prevProps) {
return false;
}
render() {
return <div ref={this.initialize}/>
}
initialize = node => {
if (!node) return;
const app = this.props.src.init({ node, flags: this.props.flags })
if (typeof this.props.ports !== 'undefined') {
this.props.ports(app.ports);
}
}
}
export default ElmComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment