My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
What is the best way to find out if React is rendering on the client or the server?

What is the best way to find out if React is rendering on the client or the server?

Ajar's photo
Ajar
·Apr 3, 2016

Hi all, what is the best way to find out if react is rendering on the client or the server? All the examples I found use reat's own internals

var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;

From what I've read, this is considered to be a bad practice since it is likely to break...

Any suggestions?
Cheers