torhovland / flatware

Type-safe F# state management (like Elm and Redux) for Blazor
Apache License 2.0
31 stars 2 forks source link

How about nested components? #3

Closed libary closed 6 years ago

libary commented 6 years ago

Will it works? I would like to get an example. Thanks!

torhovland commented 6 years ago

That's a good point. I've added another Counter as a nested component inside FetchData, with just one line of code. You will find that both Counters cooperate on the same state. This is actually a good demonstration of the purpose of state management, because when you do this in vanilla Blazor, the Counters become independent.

libary commented 6 years ago

How about nested components with shared model?

torhovland commented 6 years ago

@libary That should work the same way. You can actually choose if you want to make the children into ReduxComponents of their own so they can access the model directly, or whether you want to flow data to the children using properties.