Sign in
Log inSign up
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