0

I'm trying to create a slider which will have its displayed value periodically updated. An example of this would be a playback timeline on Spotify/Soundcloud/YouTube. I still want the slider to accept user input, which is why I'm not using a LinearProgress component.

However, whenever the value attribute is updated, I receive the following error message:

Material-UI: A component is changing an uncontrolled Slider to be controlled.
Elements should not switch from uncontrolled to controlled (or vice versa).
Decide between using a controlled or uncontrolled Slider element for the lifetime of the component.

Is it possible to control the slider's value without user input? Or do I need to use a LinearProgress and a Slider separately?

GabeyBaby
  • 31
  • 3

1 Answers1

1

I have found my mistake. My initial state's sliderPosition was set to null. I fixed it by setting initial state's sliderPosition to zero.

This is the post that explains it further: A component is changing an uncontrolled input of type text to be controlled error in ReactJS

GabeyBaby
  • 31
  • 3