Hello, the problem I face is that I want to return the innerHTML of a component via web_sys. I do this via the get_element_by_id method and I expect that each div has a unique Id (there will be multiple of them that I will need to gather the HTML from separately. Now, maybe i could use something like the UUID crate to make the unique Ids, but since there is no security concern I would like to simply have a counter and increment it by one each time there is a new component rendered. However, the data structure which handles rendering the components is recursive, meaning that I would have to drill the counter state down to deeply nested components if using use_state or use_ref, I wouldn`t be able to use_shared_state since that only operates down one level of nesting as far as Im aware. Is there any hook that is correct for this use case, maybe use_context, but I also dont know how that one works at all. pls help.
#How to create some sort of global state in your app
1 messages · Page 1 of 1 (latest)