react-force-graph
react-force-graph copied to clipboard
[Typescript] Functional components and ReactDom
Hey @vasturiano!
I noticed on many of your examples, they're using jsx and on some you are referencing the components as functions. Do you have an example of this in Typescript?
Also, I notice that you generally split the graph into a separate div element. Do you have an example where it shares the same root div as React does?
Hi @jonathan-irvin,
I suppose you're referring to this method of invoking React render: https://github.com/vasturiano/react-force-graph/blob/master/example/click-to-focus/index.html#L43-L46
I can imagine it's no different when using Typescript, other than the file should have a .tsx
extension. In any case, it is more of a typescript+react type of question and not specific to this lib.
I'm not sure I fully understand your 2nd question about the root div, could you elaborate?
Regarding the second question, I think he means the following if it's possible
ReactDOM.render(
<ForceGraph2d />,
document.getElementById('root')
);