Replies: 1 comment
-
You can use There is an issue about documenting dynamic signals here: DioxusLabs/docsite#370 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
Dioxus enforces the rule that hooks must be called at the top level of components, prohibiting their dynamic invocation inside loops or conditionals. While this ensures predictable execution, it complicates scenarios where signals need to be dynamically added in response to user actions.
The Problem
Consider the need to dynamically manage a collection of signals for a list of key-value pairs passed as props. For instance, when clicking a "+" button to add a new pair, each key-value pair should have its own associated signals. However, due to Dioxus's constraints, calling
use_signal
dynamically is not allowed. How can this be achieved idiomatically?Example
Questions
Beta Was this translation helpful? Give feedback.
All reactions