DEV Community

Discussion on: React Hooks (useContext, useEffect, useState, useRef) Summarized Like Crazy (Short & Concise Article)

moustachedsign profile image
Moustache Design

yes, the difference is querySelector is imperative, useRef declarative, also querySelector does a search for the string you pass to it, so you have to know that is unique and won't change.
useRef on the other hand, ties itself to that jsx element and nothing else.

Thread Thread
ishakmohmed profile image
Mohmed Ishak Author

Cool!