试图重构React应用程序以引起react-redux发行卷滑块
我一直在做freecodecamps鼓机应用程序。我能够完全使用React完成该应用程序,但我制作了一份副本,以尝试将React-Redux一起使用,并且在试图重构输入滑块时我的操作并不正确。它不会更改剪辑的音量,也不会随着卷更改而更新显示屏。
这是我的工作反应应用 仅反应鼓机
这是我试图重构的人 react-recept-redux鼓机
这是我试图理解很多我的人,如何付诸实践我从freecodecamp学到的东西 j8ahmed鼓机
我认为这可能是此代码的东西,但我不确定
<input type="range" min="0" max="1" step=".1" value={this.props.volume} className="slider" id="myRange" onChange={(e)=>{this.props.volumeToggle(e)}}/>
I've been doing freecodecamps Drum Machine app. I was able to complete the app completely with React but I made a copy to try and get familiar with using react-redux together and I'm not doing something correct when trying to refactor the input slider. It will not change the volume of the clips and it does not update the display with the volume change.
This is my working react app
React Only Drum Machine
This is the one I'm trying to refactor
React-Redux Drum Machine
This is a guy that I patterned a lot of mine from trying to understand how to put into practice what I learned from freecodecamp
J8ahmed Drum Machine
I think it might be something about this code here but I'm not sure
<input type="range" min="0" max="1" step=".1" value={this.props.volume} className="slider" id="myRange" onChange={(e)=>{this.props.volumeToggle(e)}}/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是一个简单的错误,我将此卷函数分配给了UpdateVolume,但是在控制类中,我尝试调用this.props.powertoggle()。以下是正确的代码。非常感谢J8ahmed,当我专门给他发出消息并帮助我看到错误时,他看了一下。
App Class
Controls类
Turned out it was a simple error in the App class I assigned this volumeToggle function to updateVolume but in the control class I tried to call this.props.powerToggle(). Below is the correct code. A big thank you to J8ahmed who took a look at it when I messaged him specifically and helped me see the error.
App Class
Controls Class