-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial not working #1004
Comments
I don't see the use of I would recommend using the demo code as a basis and see if the problem still persists for you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to follow:
https://projectstorm.gitbook.io/react-diagrams/getting-started/using-the-library
I created a new typescript react project using:
npx create-react-app my-app --template typescript
Then I put the code from the tutorial into index.tsx. i.e.
import createEngine, {
DefaultLinkModel,
DefaultNodeModel,
DiagramModel
} from '@projectstorm/react-diagrams';
import {
CanvasWidget
} from '@projectstorm/react-canvas-core';
// create an instance of the engine with all the defaults
const engine = createEngine();
// node 1
const node1 = new DefaultNodeModel({
name: 'Node 1',
color: 'rgb(0,192,255)',
});
node1.setPosition(100, 100);
let port1 = node1.addOutPort('Out');
// node 2
const node2 = new DefaultNodeModel({
name: 'Node 1',
color: 'rgb(0,192,255)',
});
node2.setPosition(100, 100);
let port2 = node2.addOutPort('Out');
// link them and add a label to the link
const link = port1.link(port2);
link.addLabel('Hello World!');
const model = new DiagramModel();
model.addAll(node1, node2, link);
engine.setModel(model);
This gives the following error:
TS2786: 'CanvasWidget' cannot be used as a JSX component.
Its instance type 'CanvasWidget' is not a valid JSX element.
Type 'CanvasWidget' is missing the following properties from type 'ElementClass': context, setState, forceUpdate, props, and 2 more.
38 |
39 |
Can you suggest what I am doing wrong?
The text was updated successfully, but these errors were encountered: