I am using Material-UI with React
I have Slider and want to set the value.
class ParamBoard extends React.Component{ constructor(props) { this.sliderRef = React.createRef(); } componentDidMount() { this.sliderRef.current.value = 1 // not work. } this.hugaRef = React.createRef(); render(){ return ( <Slider step={1} min={1} max={6} marks width={1/4 } ref="{this.sliderRef}" aria-labelledby="continuous-slider" />) ) } }
Normally with jQuery I do like this ('#myslider').value(2) to get the dom and change the value.
However in Reactjs I thought I should use ref
??? is it correct or how can I fix this ??
没有评论:
发表评论