Skip to content

Use of IReadable.Observable, and should there be a useStateWith or similar #276

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

You must be logged in to vote

Yes, when you use ctx.useState a new default value is created on each render. So your lazy implementation makes sense. I don't think we expose a simple member function to do this currently.

Instead of subscribing to the observable you could use an effect. (check out the docs - URL might change in the future)

Replies: 1 comment 4 replies

Comment options

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

@JaggerJo
Comment options

@marklam
Comment options

@JaggerJo
Comment options

Answer selected by marklam
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