param icon indicating copy to clipboard operation
param copied to clipboard

Add .set or .update method to reactive expression

Open MarcSkovMadsen opened this issue 1 year ago • 1 comments

I often have the need to update a reactive expression. Over and over again I find that I lack a .set or .update method. I need that to be able to update via callbacks, .bind or in lambda expressions. Its friction I have to create a set or update function my self.

Please add a .set method.

expression.rx.set(value) # same effect as expression.rx.value=value

Could be used as

button.on_click(expression.rx.set)

Additional Context

This is also what React does. Provides a set_value function.

MarcSkovMadsen avatar Jul 27 '24 07:07 MarcSkovMadsen

We originally had this but then removed it because .rx.value setting seemed enough but I'd agree. Having a way to update the value with an expression rather than a statement adds a lot of convenience.

philippjfr avatar Jul 27 '24 09:07 philippjfr

Added .rx.set in https://github.com/holoviz/param/pull/957

maximlt avatar Sep 23 '25 19:09 maximlt