mentored.dev | gamified learning platform to help you become a web | Frontend Framework library
kandi X-RAY | mentored.dev Summary
kandi X-RAY | mentored.dev Summary
A gamified learning platform to help you become a web developer. · Visit · Get in touch . Report Bug ·.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mentored.dev
mentored.dev Key Features
mentored.dev Examples and Code Snippets
Community Discussions
Trending Discussions on mentored.dev
QUESTION
I've written a custom React hook called useAudio
to play sounds in the background of my app.
Why is useEffect
throwing Uncaught (in promise) DOMException
?
I've narrowed the issue down to the second useEffect
inside my custom hook. This effect runs when a Boolean indicating whether the audio is playing
changes.
All React says is Uncaught Error: The error you provided does not contain a stack trace.
I also tried modifying audio
to be a regular constant instead of declaring via the useState
hook but that didn't solve it.
ANSWER
Answered 2019-Apr-09 at 06:15You've got several vague points about your app, including using hooks in conditional and storing audio
object in state (try useRef
instead, that's its only purpose). But the core of the problem it seems that url
that you feed to Audio
is undefined
. I guess CodeSandbox environment doesn't have a proper loader for mp3
files. Try some direct URL instead.
Sandbox: https://codesandbox.io/s/l7775jm2rm
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mentored.dev
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page