I'm trying to select elements (divs with a specific class) within one instance of a React component when a click event is registered from within that same component. I don't want divs with that class to be selected from other instances of this component.
My issue is that, at any given time, there could be any number of instances of this component. Do I have to create a unique ID for each component when it's mounted, or is there some way React lets me reference to only elements found within a specific instance of a component? Can it be done using a callback function within a React class somehow?
For Example:
var MyClass = React.createClass({
makeDivsBigger: function() {
...? // How to only select the divs within the current instance?
},
render: function() {
<div className="container">
<div className="dark"></div>
<div className="light"></div>
<div className="bright"></div>
<button onClick={this.makeDivsBigger}></button>
</div>
}
});