You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a site builder as Gatsby (gatsbyjs.com) any React component needs to be build-able on both server-side and client.
Since for SSR document will be undefined, this plugin cannot be used with react-chartist.
I modified the code so it's not self-calling, relying on document, when importing the module but just exports a function:
function chartistPluginFillDonut(document, Chartist) {
<the original plugin code>
}
Then in the calling module:
import chartistPluginFillDonut from "../../plugins/chartist-plugin-fill-donut";
//...
and within the functional React component that uses Chartist:
to only execute the function upon component mount on the client
Then options will need to be specified with ? since at SSR creation time the fillDonut function will not yet be defined. See also #22 for the responsiveFillDonutOptions option I added:
For a site builder as Gatsby (gatsbyjs.com) any React component needs to be build-able on both server-side and client.
Since for SSR
document
will be undefined, this plugin cannot be used withreact-chartist
.I modified the code so it's not self-calling, relying on
document
, when importing the module but just exports a function:Then in the calling module:
and within the functional React component that uses Chartist:
to only execute the function upon component mount on the client
Then options will need to be specified with
?
since at SSR creation time thefillDonut
function will not yet be defined. See also #22 for theresponsiveFillDonutOptions
option I added:It would be nice to make the changes so this plugin can be used in a React site builder without the above manual edits.
The text was updated successfully, but these errors were encountered: