Yêu cầu Mar 2nd, 2022 3:39 p.m. 62 0 1
  • 62 0 1
0

Cách Truyền Prop

Chia sẻ
  • 62 0 1

cho em hỏi lại 1 bài tutorial của viblo https://viblo.asia/p/tu-tao-audio-player-voi-react-07LKXmy2ZV4 tại sao onChange={handleTimeSliderChange} không truyền x mà tại sao ở trên function

const handleTimeSliderChange = ({ x }) => {
    audioRef.current.currentTime = x;
    setCurrentTime(x);

    if (!isPlay) {
      setPlay(true);
      audioRef.current.play();
    }
  };

lại nhận đc prop x v ạ ?

Mong mọi người giúp em

1 CÂU TRẢ LỜI


Đã trả lời Mar 3rd, 2022 1:59 a.m.
Đã được chấp nhận
+2

@Gemblue Bạn đọc code core của package sẽ hiểu thêm đó https://github.com/swiftcarrot/react-input-slider/blob/master/src/slider.js#L69

Chia sẻ
Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí