Answer the question
In order to leave comments, you need to log in
How to work with Style in React.js version 0.14?
Good afternoon. The essence of the problem:
With the transition to version 0.14, warning appears:
Warning: `div` was passed a style object that has previously been mutated. Mutating `style` is deprecated. Consider cloning it beforehand.
render(){
var handler_a_style = {
cursor: "pointer",
left: this.state.first_value
};
var handler_b_style = {
cursor: "pointer",
left: this.state.second_value
};
return (
<div className="rangefield" ref="line">
<span className="rangefield__handler left" style={handler_a_style} ref="span_a"></span>
<span className="rangefield__handler right" style={handler_b_style} ref="span_b"></span>
</div>
);
Answer the question
In order to leave comments, you need to log in
Most likely swears at this piece
var range_style = {
left : start,
width : end-start
};
You're mutating an object with styles - don't do it like that. If you need to change styles - create a new object and pass it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question