Skip to content

Why a Provider need a Ref to expose its State? #1102

Answered by rrousselGit
XuanTung95 asked this question in Q&A
Discussion options

You must be logged in to vote

Providers do not hold state, they are completely immutable. The state is stored somewhere else (ProviderContainer).
Providers are merely a unique key that allows accessing the state.

That's why you can override providers or scope a value for a part of the widget tree

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@XuanTung95
Comment options

@rrousselGit
Comment options

@rrousselGit
Comment options

@XuanTung95
Comment options

Answer selected by XuanTung95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1101 on January 20, 2022 13:52.