Skip to content

Instantly share code, notes, and snippets.

@spion spion/mobx.js
Created Oct 1, 2019

Embed
What would you like to do?
@observer class Chart(props) {
@computed get data() { return getDataWithinRange(this.props.dateRange) }
@computed get dimensions() { return getDimensions() }
@computed get xScale() { return getXScale() }
@computed get yScale() { return getYScale() }
render() {
// use this.xScale, this.yScale etc. component will re-render automatically if any of those update.
return <svg className="Chart" />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.