Closed riazXrazor closed 1 month ago
Encountering same issue with nextjs
anyone know what's the cause of this issue ?
sigma.js
must be run into the browser, it used the browser's API to draw the graph (ie. the webgl
API).
If you render a graph on the server side, those API are not available, that's why you have WebGL2RenderingContext is not defined
.
In the FAQ section of the website, there is a tips to use react-sigma
with nextjs
: https://sim51.github.io/react-sigma/docs/faq#is-it-possible-to-use-this-project-with-nextjs-
Can you try it and tell me if it works (it has been written a long time ago, but I think it's still valid) ?
@sim51 thanks , i managed to fix the issue by coding like this
"use client";
import dynamic from "next/dynamic";
const NetworkGraph = dynamic(() => import("@/components/network-graph"), {
ssr: false,
});
export default function Test() {
return <NetworkGraph />;
}
code in page
Error on console
lib versions
react and NextJS version