revery-ui / revery

:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
https://www.outrunlabs.com/revery/
MIT License
8.07k stars 197 forks source link

Compatibility with ReasonReact? #523

Open satvikpendem opened 5 years ago

satvikpendem commented 5 years ago

Can Revery be used along with ReasonReact so that I can run a web app but also use it natively like Electron? What's the level of compatibility, if any, and what code would need to be changed for this to be possible (ie could Revery's version be a drop in replacement for ReasonReact)? I saw that you can use WebGL on the Playground, with React Hooks, but I'm not sure if that's true ReasonReact or just your own version.

baransu commented 5 years ago

If I'm correct Revery uses https://github.com/briskml/brisk-reconciler which is native React-like implementation allowing to do all cool React-like stuff. Revery has js+wasm output that's how Playground works but it's far from ReasonReact.

satvikpendem commented 5 years ago

I was thinking similar to how React Native Web and Flutter Web are used. There is an abstraction on top of UI trees, such as the DOM and whatever is used for mobile. What if there were a way to use Revery as a drop in replacement for ReasonReact, where instead of open ReasonReact it's open Revery?

That means the API for both needs to match (function / module names, etc). It seems to already do so now, so I was wondering if this were possible. How it works now is through WebGL which is not accessible since it's not true DOM nodes being created but simply a <canvas> that renders elements. If there were a drop in replacement for ReasonReact, you could use the same code base, just the open library imports would change, and for the web, one can emit DOM, and for native, one can emit OpenGL.