theia-ide / sprotty

A next-gen web-based graphics framework
Apache License 2.0
138 stars 23 forks source link

Usage with react #203

Closed rob-myers closed 6 years ago

rob-myers commented 6 years ago

I'm trying to follow your /Getting-Started.

When attempting to extend CircularNodeView, the render method has return type VNode. I can see you are using snabbdom-jsx here. However, this module uses global typings which conflict with @types/react -- which I am using for other parts of the app.

How am I to proceed? Many thanks for any help.

JanKoehnlein commented 6 years ago

It looks like these brand new TS features could help: https://blogs.msdn.microsoft.com/typescript/2018/03/27/announcing-typescript-2-8/#jsx-pragma-comments https://blogs.msdn.microsoft.com/typescript/2018/03/27/announcing-typescript-2-8/#jsx-namespace-resolution PRs are welcome.

JanKoehnlein commented 6 years ago

Fixed with https://github.com/theia-ide/sprotty/commit/b64aaf041823b3da55c97b1f47dc8e5ba199dd04

As Theia now uses React as well, I had to take action. 1) I migrated the sprotty code to use local JSX factories instead. 2) With regard to the global types, the strategy is separate React JSX and snabbdom-jsx usages in distinct packages. The solution is implemented in yangster

JanKoehnlein commented 6 years ago

Two more things: