I have a flask project I am working on. I would like to be able to start replacing some components with wasm.
I was able to get the yew component to mount to a specific <div>
, But I'd like to be able to do that, as well as leverage some of the GUI libaries of Rust.
I was able to make some examples in the iced library work as WASM, but that was as standalone. I havent quite wrapped my head around how to wrap them in a <div>
and use multiple wasm/rust/yew components on a page.
A very simple example to give you an idea of implementation is below.
<!DOCTYPE html>
<html lang="en">
<head>
<script type="module">
import init from "./static/js/wasm.js";
init();
</script>
<style>
#yewapp{}
</style>
<meta charset="utf-8" />
<title>Flask+Rust</title>
<link rel="shortcut icon" href="#" />
</head>
<body>
<div>
{{ message }}
</div>
<div id ="yewapp"></div>
{{ message }} again
</body>
</html>
This works (yew app is just hello world right now).
I like the .mount(div)
functionality in yew, but if there is another way to do this I'm open to it.