Skip to content

Instantly share code, notes, and snippets.

Taylor tayloraleach

Block or report user

Report or block tayloraleach

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tayloraleach / ClientSideOnlyRenderer.jsx
Created Nov 23, 2019
React.js two-pass SSR rendering of 3rd party component (Next.js)
View ClientSideOnlyRenderer.jsx
import React, { useState, useEffect } from "react";
const ClientSideOnlyRenderer = props => {
const { initialSsrDone = false, renderDone, renderLoading } = props;
const [ssrDone, setSsrDone] = useState(initialSsrDone);
useEffect(() => setSsrDone(true), []);
return ssrDone ? renderDone() : renderLoading();
export default React.memo(ClientSideOnlyRenderer);
You can’t perform that action at this time.