Yoctol / react-d3-cloud

A word cloud react component built with d3-cloud.
https://yoctol.github.io/react-d3-cloud
MIT License
142 stars 47 forks source link

Supports for server side rendering #91

Closed lhz516 closed 3 years ago

lhz516 commented 7 years ago

When doing server side rendering (SSR), server will throw an error because document is not defined on the server. It would be great if SSR support can be added to this package.

chentsulin commented 3 years ago

don't render it till you are on client side

{
  typeof window !== "undefiend" && <WordCloud data={data} />;
}

See https://github.com/Yoctol/react-d3-cloud#nextjsssr

cesarvarela commented 2 years ago
        {
          typeof window !== "undefined" && <WordCloud data-cy="wordcloud" data={wordCloud} />
        }

(typos)