Affects Version/s: None
Fix Version/s: None
Component/s: JS APIs and Utilities
WISHLIST ITEM — We don't yet have an immediate need for this, but it is an obvious potential improvement, so I want to make a note of it.
Sibling issue to:
When working on
LPS-130359 I found myself in the original draft PR wanting to be able to read from an atom only to write straight back to it. In the final version of the PR, I refactored to do things in a different way, but here is the example of what I was wanting to do originally:
So the proposal here is to accept the "functional updater" pattern that is familiar from React's useState hook (docs):
An obvious corollary here would be to update useLiferayState to also allow this kind up write, but I'll create a separate ticket for that (LPS-131055).