Blazor State Management - Factor out the state preservation to a common location

219 Views Asked by At

enter image description here

I'm trying to understand common location for state preservation from Blazor Official Doc.

  • Should wrapping code be defined in separate razor component?
  • How that component would refer currentCount variable?

enter image description here

I have tried to define this into new component like above in my project, but variable is undefined.

How Counter.razor and CounterStateProvider.razor will be associated together?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

To summarize comments to help some on in future.

CurrentCount is the property in defined in above class.