Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theednaffattack/e9c3b8808ee94cf5112d9fb37727edf2 to your computer and use it in GitHub Desktop.
Save theednaffattack/e9c3b8808ee94cf5112d9fb37727edf2 to your computer and use it in GitHub Desktop.
const React = require("react")
const ReactDOM = require("react-dom")
const Meep = (
<div
style={{ backgroundColor: "blue", fontColor: "white" }}
onClick={() => alert("hello")}
>
Hello world?
</div>
)
module.exports = { Meep }
const SSR = (
<div
style={{ backgroundColor: "blue", fontColor: "white" }}
onClick={() => alert("hello")}
>
Hello world?
</div>
)
module.exports = { SSR: SSRComp }
const isServer = typeof document === "undefined"
console.log("isBrowser help")
console.log(isServer)
// Render only in the browser, export otherwise
if (typeof document === "undefined") {
module.exports = SSR
} else {
ReactDOM.hydrate(SSR, document.getElementById("app"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment