Saturday 6 May 2017

How can you detect if your React app has been rendered on the server?

I would like to determine in a component if my React app is building to compare against a checksum or to render normally. Is there a way to have a component behave slightly differently on the initial "checksum" render?

Specifically, I have a component that uses canvas, which the server cannot do. So on the server, I want it to just render up an empty element, and then on the client, match the checksum and subsequently update.

Or is it better, in a case like this, to just let React replace the elements the server rendered with its new ones?



via futuraprime

No comments:

Post a Comment