I wanted to build an app that would compile to both web and mobile using as much shared code as possible.
So I thought I would learn Rust, write the backend and compile it to Web Assembly... Done!
Then I just assumed I'd learn React, because of React Native I get two for the price of one. Import the WASM and front-end your way to victory!
But my front-end relies heavily on drag and drop (I'm moving 'pieces' around on a 2D 'board'), but it isn't handled natively by React, So I would need to figure out a version for web and for React Native anyway!
So before I continue in the wrong direction, I wanted to ask for some guidance.
What tech, framework, language, should I be putting my energy in now in order to achieve this?
Mobile devices have browsers… so if your app runs in a browser, it also runs on mobile.
Working with the web means you need to learn the APIs and JavaScript quite well, otherwise you are getting lost constantly.
If adding Rust to that is worth it, will depend a lot on the application and how much it interacts with the browser. (The more interaction, the less you benefit.)
React Native appears to be written in C#, so don't expect benefits from using Rust to talk to it.
Rust is a very powerful language that also allows you to write applications running in the browser. That does not mean it is the best language for that. Rust is quite complex and will require lots of time to learn. If you want to build complex software running directly on a computer while being very fast and efficient, it is one of the best languages out there. But for a web application … very unlikely.
I don't know much about SDL2, other than avoiding it. It add dependencies to C libraries which are manged by a package manager… so a good change of things breaking.
I am working on Γραφείο, a document editor that works native and via WebAssembly in the browser. It uses Pathfinder for drawing. Pure Rust for the native build with some JS glue for the browser version.
There is no GUI toolkit for it ready yet, but there are thoughts of getting Iced to work with it.