This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
Need help with using useRef() with recoil. #2326
Unanswered
nikhilcbhat021
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am new to web development AND to Recoil. Please correct me if I got some concepts wrong :).
I am trying to build a music player application using Recoil ,
and I am facing a blocker.
I had thought to use 'audio' tag to control the playback and attaching a reference to it (useRef).
Then, access this reference, to play, pause, update track etc, when user clicks on the track card...
The problem is I am not able to initialise it. I tried the following :-
added default: useref().
added an inline selector (default: selector...) that returns a useRef().
set default: null, then in the Component, on load, checked if its null => then set it to useRef -- (setter(useRef())).
Any ideas how I can solve this ??
Beta Was this translation helpful? Give feedback.
All reactions