Skip to content

How to create a useful state store? #397

Answered by JaggerJo
sixilli asked this question in Q&A
Discussion options

You must be logged in to vote

I get all the issues you describe above. For some of them I found good solutions, but not for all. It's quite hard to make all the transformations without breaking the reactive chain.

I'm wondering if it would have been better to base the state implementation on IObservable + IObserver, but what's missing is a way to obtain the current value.

Option type

Yeah, thats true. You can solve that by combining State.filter and State.map. Maybe there should be a State.choose.

Discriminated Unions

Yeah, it's tricky.

  • You need to look at the state value in order to decide which view to render
  • You need to build a reactive chain that points to an optional value (issue from above)

Code below is untes…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@sixilli
Comment options

@JaggerJo
Comment options

Answer selected by sixilli
@sixilli
Comment options

@JaggerJo
Comment options

@sixilli
Comment options

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