question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to access values from button callback?

See original GitHub issue
const  { num, button } = useControls({
    num: 0,
    button: button(() => console.log(num)
});

How can I access the current value of num from inside the callback inside button? I only get the initial value on num even after updating the value from the leva UI panel

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dbismutcommented, Dec 17, 2021

In 0.9.18:

const values = useControls({
  number: 3,
  foo: button((get) => alert(`Number value is ${get('number').toFixed(2)}`)),
})
0reactions
nomentechcommented, May 15, 2022

yep, it works. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access return value from event Listener callback function from ...
I have a form which contains an input field and a submit button. The whole program depends on the submission of ...
Read more >
show and get data in button callback at GUI - MATLAB Answers
I need to show and get this data in While code in button callback function. Please see my codes: Theme.
Read more >
How can I pass arguments to Tkinter button's callback ...
Running the above code will display a window which contains a text label and a button to change the value of the label....
Read more >
Part 3. Basic Callbacks | Dash for Python Documentation | Plotly
In this example, changing text in the dcc.Input boxes won't fire the callback, but clicking on the button will. The current values of...
Read more >
MATLAB GUI : Button Callback to read values from .mat file
When I want to use a button callback to plot graphs using the values in the .mat file, I am unable to do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found