Adding a ref to the body tag using Helmet in React

2 replies
Last updated: Jul 2, 2020
is it possible to add a
ref
to
<body>
? I have added classes using
Helmet
but can't seem to figure out if i can add
ref
this way too
Jul 2, 2020, 4:15 PM
Since there’s a stable global accessor for it (
document.body
) you probably don’t need a ref.
Jul 2, 2020, 5:41 PM
yeah, i figured that out after posing the question.
my original problem was i was trying to get to it via a class name rather than it directly
Jul 2, 2020, 5:49 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?