Document the difference between `use_context` and `consume_context`
I'm currently learning Dioxus, but I often feel that the documentation regarding the differences in similar features is insufficient.
I've read the following pages, but they don't explain the difference between use_context and consume_context.
- https://dioxuslabs.com/learn/0.6/guide/state#global-state-with-context
- https://docs.rs/dioxus/latest/dioxus/prelude/fn.use_context.html
- https://docs.rs/dioxus/latest/dioxus/prelude/fn.consume_context.html
Could you document the difference between them and when to use which?
The only difference is use_context is a hook and must be called with the rules of hooks. consume_context can be called from anywhere inside the dioxus runtime
I agree, a short section in the state part of the guide would be nice.
For example, now knowing that use_context is a hook wrapper, why would I ever want to use use_context over consume_context? This is still not clear to me, seems to just be adding constraints for no benefit?