Setting an attribute in React is straightforward if you know the key, e.g.
data-500={this.props.YDistance}
but how can one dynamically set part of the key. e.g.
data-{this.props.YDistance}="valueHere"
var Test = React.createClass({
render: function() {
return (
<div data-{this.props.YDistance}="valueHere">
{this.props.children}
</div>
);
}
});
ReactDOM.render(
<Test YDistance="500">Hello World!</Test>,
document.getElementById('container')
);
There are libraries that require this kind of attribute setting (e.g. skrollr et al)