[question] Add component to DOM dynamicly #2409
-
I'm new to yew so forgive me if this is a stupid question but how do you add elements to the DOM at runtime? All of the examples and docs I have read all seem to not create or destroy any elements. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I highly recommend you read our docs and go through our tutorial at https://yew.rs But to give you a basic gist Yew is at its its core very dynamic / reactive (like react.js) library. In your case you can keep the data list in yew component state and then turn them into html like shown here https://yew.rs/docs/concepts/html/lists |
Beta Was this translation helpful? Give feedback.
I highly recommend you read our docs and go through our tutorial at https://yew.rs
But to give you a basic gist Yew is at its its core very dynamic / reactive (like react.js) library.
It operates on the idea that you have stored data, that you then "render" into html.
In your case you can keep the data list in yew component state and then turn them into html like shown here https://yew.rs/docs/concepts/html/lists
Then when your state changes your component will be re-rendered based on the new list :)