use Ref for the body elem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

use Ref for the body elem

How to target useRef in <body> tag ,For react js since we start wroking directly from app.js

6th Mar 2021, 1:03 PM
anjit pariyar
anjit pariyar - avatar
2 Answers
+ 4
Since body isn't part of your react code base, you don't have to use useRef to access body. You do it as you do it in normal JS. document.body.whatever = someValue;
6th Mar 2021, 1:49 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
Raj Chhatrala for now I'm in doing the same ..but firebox always warn you for using dom inside react that's why I'm asking
8th Mar 2021, 3:16 AM
anjit pariyar
anjit pariyar - avatar