Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Map should not accept a backgroundColor prop #1

Open
WickyNilliams opened this issue Aug 28, 2014 · 0 comments
Open

refactor: Map should not accept a backgroundColor prop #1

WickyNilliams opened this issue Aug 28, 2014 · 0 comments

Comments

@WickyNilliams
Copy link
Owner

By accepting backgroundColor as a prop, any change to the hue slider will always cause a re-render of map (as the bg hue changes). if we move this prop to another div (in ColorPicker?), or compose a ColorMap from a Map, we can avoid a re-render of Map:

var ColorMap = React.createClass({

  render: function() {
    return (
      <div style={{ backgroundColor : this.props.backgroundColor }}>
        <Map
          x={this.props.x}
          y={this.props.y}
          max={this.props.max}
          onChange={this.props.onChange}
        />
      </div>
    );
  }

});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant