JSFiddle - React, Tailwind, and code Playground
by vjeux
JavaScript
React.createClass({
onClick: function(x, y) {
this.props.onClick(x, y);
},
componentDidMount(node) {
this.setState({
map: L.map(node).onClick(this.onClick)
});
},
componentReceiveProps(nextProps) {
if (this.props.x !== nextProps.x || this.props.y !== nextProps.y) {
this.state.map.setView([nextProps.x, nextProps.y]);
}
},
render: function() { return <div />; }
});