DEV Community

Discussion on: Render Browser Specific Content with React 🎉

Collapse
 
satya164 profile image
Satyajit Sahoo

Code doesn't execute during build time. Though it will execute during SSR. Doing it in constructor/render will make it execute during SSR which will fail. You can do it in componentDidMount and update state to make sure it only executes on client.

Thread Thread
 
flexdinesh profile image
Dinesh Pandiyan

You're right. I meant the build time assignment evaluation that happens when we run minification as how uglify plugin does. Still, it wouldn't matter as we wrap all the browser detection as individual methods.