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

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct