Questions tagged [yew]

Rust/Wasm framework for creating web applications

Yew takes inspiration from React and Redux. It uses Web Assembly and webworkers to create multi-threaded frontend apps.

The repository lives at https://github.com/yewstack/yew.

124 questions
3
votes
1 answer

Using wasm_timer in Yew to execute callback repeatedly

I'm still rather new to Rust and have a hard time wrapping my head around futures. I want to implement a "timer app" in the browser and to do so I'm using https://yew.rs/. For the timer I tried to use https://github.com/tomaka/wasm-timer/, but there…
Achim
  • 15,415
  • 15
  • 80
  • 144
3
votes
1 answer

WASM/Yew - failed to resolve: could not find `unix` in `os`

Building Yew App on Windows I'm building a yew app alongside a rocket backend on Windows following this tutorial (although the tutorial is for a Linux environment). I'm trying to build the yew app using wasm-pack. I'm not using the Linux subsystem…
Zachary Delano
  • 111
  • 1
  • 15
3
votes
1 answer

How to implement a Stateful App Navigation using Rust and the Yew Crate?

I'm trying to build an app with navigation tabs and trying to use the best way to give state to the entire app. Currently the tabs are functional, but I am struggling to implement a way to both map and restore tab navigation via state in rust using…
2
votes
1 answer

use_state in Yew

I am new to Rust and Yew and I need some assistance in applying a useState hook inside an app component in Yew that looks like this: struct BookList use gloo_net::http::Request; use yew::prelude::*; #[function_component(App)] pub fn app() ->…
Daniel
  • 14,004
  • 16
  • 96
  • 156
2
votes
1 answer

How do I remove this compiler error for use_store with yewdux?

I am learning yewdux and have implemented the tutorial code for global state: use yew::prelude::*; use yewdux::prelude::*; #[derive(Default, Clone, PartialEq, Eq, Store)] struct State { count: u32, } #[function_component] fn App() -> Html { …
Eli
  • 23
  • 3
2
votes
2 answers

Using Cookies in Yew

I'm building a Rust + Yew app rendered on the client side. After looking for some time in the docs, I couldn't found the proper way to handle cookies. Does anybody knows how to do it? I want to set an auth token in the cookies.
2
votes
2 answers

Error: error getting canonical path to source HTML file "index.html" in rust

I've just started a client side project in yew(rust frontend framework). I've just written a few lines of code and I'm getting the following error. Error: "error getting canonical path to source HTML file "index.html". My cargo.toml, main.rs…
2
votes
1 answer

How to make POST request with JSON body using web-sys in WebAssembly?

How to create POST request with JSON body using web-sys in WebAssembly? This example below showing how to make GET request, I need to change opts.method("GET"); to opts.method("POST"); but how can i pass a JSON body to the reqeuest. let mut opts…
obei
  • 115
  • 2
  • 10
2
votes
1 answer

Yew application unable to access static files when hosted in GitHub pages

I have this website I'm planning to host in GitHub pages. The URL for the home page contains the name of the repository https://s1n7ax.github.io/my-website/. Static files linked in the HTML is trying to access them in https://s1n7ax.github.io base…
s1n7ax
  • 2,750
  • 6
  • 24
  • 53
2
votes
1 answer

How to query and update the DOM with yew?

Is there any way to make DOM action via use_node_ref? or alternatively, how to do document.query_selector() in Rust using yew? use web_sys::HtmlInputElement; use yew::{ function_component, functional::*, html, NodeRef,…
Ali Husham
  • 816
  • 10
  • 31
2
votes
1 answer

How to separate yew components to different files?

I just started learning yew (frontend framework). How do i put every component in separate file, like in js frameworks. (i am using function components now)
smolovk
  • 61
  • 3
2
votes
0 answers

How do I mount multiple wasm components to a page?

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
, But I'd like to be able to do that, as well as leverage some of the GUI…
krflol
  • 1,105
  • 7
  • 12
2
votes
1 answer

How to serve multiple HTML pages using Wasm with Rust?

I am trying to build a web application running wasm on the client side, and I am wondering what would be a good way of serving multiple pages. My main concern is performance, because I would like to split the application up into contextual chunks…
stimulate
  • 1,199
  • 1
  • 11
  • 30
2
votes
1 answer

Rust ffi + wasm (yew -> cargo web start) -> fatal error: 'math.h' file not found

I'm currently developing an application using C and Rust, where I don't have any problems when it's used in either of the following ways: C -> Rust -> C (swift) C -> Rust -> examples (console Rust) but it's getting complicated when I want to…
Stéphane
  • 143
  • 1
  • 10
1
vote
1 answer

Why trunk serve doesn't automaticly serve when saving file?

I'm using trunk serve in my rust project in Windows, everything goes great and compiles and serves, but if I save the file, it doesn't automactly re-compile and serve. I was expecting it to when I save any of the rust file it to compile and serve, I…
aikoo7
  • 11
  • 1
1
2
3
8 9