react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Question: Can I use this library to work with ReactJS+JSX based project?

Open ganesh-sankey opened this issue 8 years ago • 4 comments

Thank you for this amazing library.

Can I use this library to implement graph based flow system with ReactJS+JSX. since these library is based on ReactJS+TSX. I want to know whether it will be compatible with above environment setup. I should be able to create/perform/customize all the functionalities provided by this library in ReactJS+JSX. It means can I create customized Link, Node, Anchor and also all the similar functionalities provided in demo project-storybook (simple flow, zoom to fit, smart routing) ? I did try to render simple node using library with ReacJS+JSX. It worked well but I am worried about all customization part. whether It is possible with ReactJS+JSX. or should I create project in React+TSX enviroment. I am kind of new to ReactJS ecosystem.

ganesh-sankey avatar Mar 06 '18 05:03 ganesh-sankey

+1

silvacpp avatar Mar 06 '18 13:03 silvacpp

Well answer is yes indeed. Just import library classes, like in demos.

JokerNN avatar Mar 06 '18 14:03 JokerNN

Answer is indeed yes. The typescript gets compiled down to ECMA 2015 but you can also choose a different level of ECMAScript through other outlets such as cloning this repo, referencing the typescript src and many others. I would however, strongly encourage you to write your new projects in typescript, once you get a taste of its awesomeness, you will never go back :P

dylanvorster avatar Mar 06 '18 19:03 dylanvorster

I'm trying to import this into an existing ReactJS project. The existing version I have runs fine using DefaultNodes, but when I try to create my own custom nodes using the Diamond Node example I run into all kinds of problems, i.e.

WEBPACK_IMPORTED_MODULE_3__DiamondNodeFactory_tsx.DiamondNodeFactory is not a constructor

When I

 import {DiamondNodeFactory} from './DiamondNodeFactory.tsx'
...........
    this.diagramEngine.registerNodeFactory(new DiamondNodeFactory())

I'm assuming it's running into problems mixing Typescript with Javascript.. have you any ideas why it won't compile?

bknill avatar Mar 21 '18 21:03 bknill