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
1
vote
1 answer

SVG shadows do not repeat the element contour

I am trying to render an SVG world map where I can select countries. I want to add a shadow effect for a particular country for the onmouseenter event. Everything works fine except that for some countries shadows do not follow the country border…
kasom
  • 43
  • 4
1
vote
1 answer

how to include a sleep function in Yew app?

I am trying to build small application with Yew (Rustwasm) . I would like to put sleep function in Yew app.when I use use std::thread::sleep , I am getting below error I am using sleep as below let mut index = 0; sleep(Duration::new(1, 0)); if col <…
Naveen
  • 109
  • 1
  • 6
1
vote
1 answer

Uncaught Error with Webassembly using Yew Framwork

I'm using Yew to program a theme switcher that by clicking cycles through different themes. This is my update function. It gets the current theme which is stored in shared state, depending on what would come next inside theme_cycle the theme value…
wjatscheslaw
  • 49
  • 1
  • 10
1
vote
2 answers

Yew error – only one root html element allowed

I have encountered a problem with the Yew library's component mechanism. If I include any other html code in the macro for the main model's html macro, the compiler complains that "only one root html element allowed". My structure is as…
mostsignificant
  • 312
  • 1
  • 8
0
votes
0 answers

Access Tauri's plugin variable from Yew frontend

I have a project that contains Tauri backend and Yew frontend. I'm trying to save a form variable to file with tauri_plugin_store library. But the documentation is horrible and I'm not sure how to call store variable from my frontend or just from…
Marcel Kopera
  • 179
  • 11
0
votes
0 answers

Why I'm not able to check radio button after cloning value in Yew

I'm trying to change checked radio-button on click with my code in Yew. let radio_buttons = vec![ ("monday", "monday1"), ("tuesday", "tuesday1"), ("wednesday", "wednesday1"), ("thursday", "thursday1"), …
Marcel Kopera
  • 179
  • 11
0
votes
1 answer

Is there any way to cast a Callback into FnMut(MouseEvent)?

I'm implementing material 3 from scratch with web_sys and writing some adapters for different frameworks among them yew. I have implemented a basic structure for buttons something like this to use like this. This works fine on web_sys but I'm trying…
al3x
  • 589
  • 1
  • 4
  • 16
0
votes
1 answer

&str not converted into StyleSource implicitly in rust stylist

I am trying out yew and stylist for the first time in rust. As per the tutorials, i should be able to convert &str into the required type, but it produces the error given as: the trait `From<&str>` is not implemented for `StyleSource` The error is…
0
votes
0 answers

thread 'tokio-runtime-worker' panicked at 'error binding to 127.0.0.1:8080: error creating server listener

when i tried to run trunk serve this errror pops up thread 'tokio-runtime-worker' panicked at 'error binding to 127.0.0.1:8080: error creating server listener: An attempt was made to access a socket in a way forbidden by its access permissions. (os…
0
votes
0 answers

Yew add Javascript onclick function (ssr) (not yet answered)

I would like to do something like this, where func is a Javascript function defined. html! { } However, the compiler keeps telling me that I'll need to use a rust callback instead. I'm doing ssr,…
Siriusmart
  • 187
  • 1
  • 12
0
votes
0 answers

How can I poll or execute impl future in wasm

#[function_component(AuthSignUp)] pub fn render_auth_sign_up() -> Html { // ....... let onclick = Callback::from(move |_| { let username = (*username_clone).clone(); let password = (*password_clone).clone(); let user_reg =…
0
votes
1 answer

Getting Error while trying to use stylist on my app in yew

this is my code in Yew use yew::prelude::*; use gloo::console::*; use serde::{Serialize, Deserialize}; use stylist::{yew::styled_component, style}; const STYLE_FILE: &str = include_str!("main.css"); #[styled_component(App)] pub fn app() -> Html…
Marcel Kopera
  • 179
  • 11
0
votes
0 answers

How can I upload a .json/.csv file using POST method with Rust in Yew framework (0.18)

Here are my codes, the uploaded file are stored as self.file (which is an Option that converted to String using .into_iter()). But using .into_iter() cause an error stating: `FormData` is not an iterator the following trait bounds were not…
0
votes
0 answers

Cant use props because of props escaping function body

#[derive(PartialEq, Properties)] pub struct ItemProps { cost: i128, purchaseCallback: Callback, name: String, imgUrl: String, cookiesPerSecond: i128, itemIndex: i32, } #[function_component] pub fn Item(props:…
Ryan LeRoy
  • 19
  • 2
0
votes
1 answer

Mutating Variable inside a Yew Callback

Working forward from the last example in this page of the Yew Docs, I'd like to use a callback to update the label on an input, rather than just outputting a console message. Or in other words, having done what the example does successfully, I'd…
djmcmath
  • 97
  • 5
1 2 3
8 9