File size: 470 Bytes
feca495
 
f14eb69
feca495
d737dbb
feca495
d737dbb
 
f14eb69
d737dbb
 
 
f14eb69
d737dbb
f14eb69
d737dbb
f14eb69
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use client';

import React from 'react';
import ForceGraph2D from 'react-force-graph-2d';
import ForceGraph3D from 'react-force-graph-3d';

interface ForceGraphWrapperProps {
  dim?: 2 | 3;
  fgRef?: React.RefObject<any>;
  [key: string]: any;
}

export default function ForceGraphWrapper({ dim = 2, fgRef, ...rest }: ForceGraphWrapperProps) {
  if (dim === 3) {
    return <ForceGraph3D {...rest} ref={fgRef} />;
  }
  return <ForceGraph2D {...rest} ref={fgRef} />;
}