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
0
votes
1 answer

Rust / Yew Geolocation

I'm trying to retrieve the user's lat/lon, once, in the create function of a Yew Component, so that I can do some math and pass useful decisions to child components. I've made the Yew hook "use_geolocation()" work just fine, but that only runs in a…
djmcmath
  • 97
  • 5
0
votes
1 answer

Howto add .is-active css class when click Route Link in yew?

Here is a simple bulma css navbar in yew. My question is howto add .is-active class to 'navbar-item' when navigate by click Route link? It looks like I have to use some stateful utils here. But I can't intercept the onclick event in Route Link. use…
tempbottle
  • 33
  • 4
0
votes
1 answer

Can I put field bounds on a template type in Rust?

In rust I can put trait bounds on a template argument to guarantee it conforms to the functionality I want: fn print(t: T) { println!("{:?}", t); } Can I do something similar with fields? fn print_name(t: T) { …
matanmarkind
  • 219
  • 3
  • 13
0
votes
1 answer

Auto Update Year in Yew Wasm Rust

I am trying to update the copyright year in yew wasm (rust). This is the below code I am trying but it does not work unfortunately. use yew::prelude::*; use chrono::prelude::*; #[function_component(Footer)] pub fn footer() -> Html { let…
Thamognya
  • 123
  • 1
  • 10
0
votes
1 answer

How do send reference to a sub-tree in a message in Yew

I have a simple Yew app in which I draw a binary tree and render it in HTML. I want to make it so that I save in the model (the App type) which Node or Leaf is currently selected. (I will then color that one differently) I added an Annot struct, and…
Joomy Korkut
  • 514
  • 1
  • 5
  • 15
0
votes
1 answer

How to read and parse html from files or from string?

goal convert this HTMl string into macro or into node element use html_parser::Dom; let html = r#"

hello world

hi paragraph

"#; let nodes = Dom::parse(html).unwrap_throw(); //…
Ali Husham
  • 816
  • 10
  • 31
0
votes
3 answers

Do a web request in yew.rs v0.19

In yew 0.2 Request::get worked fine but now yew::services doesn't exist, how can I make a request to /api/ping? do I need javascript?
Brian3647
  • 23
  • 7
0
votes
2 answers

No matching package found

I am trying to integrate an API in a yew project and facing the following issue: Dark@Dark:/var/www/html/yew-practice$ wasm-pack build --target web Error: Error during execution of `cargo metadata`: Updating crates.io index Updating git…
0
votes
1 answer

How to make JAWS screen reader acknowledge dynamic content updates

Recently, I've been investigating Web Assembly (WASM), Rust and Yew. To reproduce my problem, I've added the code of my project below. There's nothing wrong with the code per se, so you can skip it if you don't want to reproduce the setup…
TimB
  • 970
  • 8
  • 17
0
votes
1 answer

yew app - rustwasm error Uncaught RangeError: Maximum call stack size exceeded

I was trying to solve sudoku as Yew app. Using yew="0.17.4" version. But getting below error Uncaught RangeError: Maximum call stack size exceeded at dlmalloc::dlmalloc::Dlmalloc::malloc::hb6b25cc27fa2f08c…
Naveen
  • 109
  • 1
  • 6
0
votes
1 answer

Where is the classes! macro in Yew

I am using Yew for one of my experiment project. What is module to import for the classes! macro? html! {
Naveen
  • 109
  • 1
  • 6
0
votes
1 answer

How can I propagate html strings in a Yew application?

Let's say a Yew app currently uses, { "foo" } How can I emit that in such a fashion that it's not safely encoded as HTML, and instead rendered by the client as HTML and sent out unencoded.
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
0
votes
1 answer

Yew callback for different Json structs

I am using yew with the WebsocketService and sending jsonrpcs to a backend and receive the according answers. I have a problem to distinguish between valid and error jsonrpc answers. Within the model implementation, I create the callback via: let…
mostsignificant
  • 312
  • 1
  • 8
0
votes
1 answer

How do I genericize Yew web request

I'm trying to figure out how to make this web request code from the yew examples generic for Deserialize types and variants of an enum. // Deserialize type #[derive(Debug, Deserialize)] pub struct TagsResponse { tags: Vec, } // Enum…
greggreg
  • 11,945
  • 6
  • 37
  • 52
-1
votes
1 answer

Calling the same onclick function again gives error

Calling the same function again gives move error. use gloo::console::log; use yew::prelude::*; use web_sys::HtmlInputElement; use wasm_bindgen::JsCast; #[function_component(CheckMnemonic)] pub fn check_mnemonic() -> Html { let tags_state:…
Amiya Behera
  • 2,210
  • 19
  • 32
1 2 3
8
9