Render should be last method declared

This commit is contained in:
Jorik Schellekens 2020-04-21 10:15:37 +01:00
parent 787e408016
commit 4d0cac1260

View file

@ -35,6 +35,10 @@ export default class Slider extends React.Component {
};
_offset(values, value) {
return (value - values[0]) / (values[values.length - 1] - values[0]) * 100;
}
render() {
const dots = this.props.values.map(v =>
<Dot active={v<=this.props.value}
@ -43,7 +47,7 @@ export default class Slider extends React.Component {
key={v}
/>);
const offset = this.offset(this.props.values, this.props.value);
const offset = this._offset(this.props.values, this.props.value);
return <div className="mx_fontSlider">
<div>
@ -60,10 +64,6 @@ export default class Slider extends React.Component {
</div>
</div>;
}
offset(values, value) {
return (value - values[0]) / (values[values.length - 1] - values[0]) * 100;
}
}
class Dot extends React.Component {