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.

Get Ref of Buttons

See original GitHub issue

What problem does this feature solve?

For some reason I need to access to the DOM element from the button but currently I don’t think it’s possible with ant.

What does the proposed API look like?

<Button ref={(ref) => { this.buttonRef = ref; }) />

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
gaastonsrcommented, May 23, 2017

I did something similar but I thought using refs was a cleaner implentation that’s why I opened this issue 😃

By the way you can just do 😉

<Input value={props.value} readOnly />
<Button className="btn-copy">{props.label}</Button>
componentDidMount () {
    this.clipboard = new Clipboard('.btn-copy', {
      text: () => this.props.value
    });
}
0reactions
lock[bot]commented, May 23, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get ref value of button in function [react] - Stack Overflow
How can I get ref value of clicked button? Below short explain my problem: Input: [button1] <-click Output: "btnRef1".
Read more >
Forwarding Refs - React
This way, components using FancyButton can get a ref to the underlying button DOM node and access it if necessary—just like if they...
Read more >
The Complete Guide to useRef() and Refs in React
How to use React.useRef() hook to create persisted mutable values (also known as references or refs), as well access DOM elements.
Read more >
Solved: Get reference of button from Module - Esri Community
I'm capturing ProjectOpenedEvent in Module1.cs and want to execute come code located in button class. No dockpanel associated with button so can ...
Read more >
A complete guide to React refs - LogRocket Blog
When we obtain a node using a ref and later modify some attribute or ... a representation of an HTML button element —...
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