Confusion around obtaining a ref to a Button/IconButton element
See original GitHub issueWhen reading the documentation, I find it confusing that IconButton
(doc) is documented to have a buttonRef
and a rootRef
props. What’s the difference between those two? Also, why Button
(doc) is documented to have none of those? And then ButtonBase
(doc) has rootRef
but no buttonRef
.
Additionally, I find that in the release notes of v1.0.0-beta.27 rootRef
is being removed from some components (although I don’t see any button component being mentioned there).
Finally, while using these components under the latest release (beta.30) which is already after beta.27, I get buttons to work using rootRef
, even when they don’t have this prop documented. And I get icon buttons to work with buttonRef
but not with rootRef
, even when they have both documented.
So which one is it?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (6 by maintainers)
Top GitHub Comments
Alright. Let’s implement it 😃.
Ok, good to know about that other react issue. BTW, that one also does not recommend the use of
findDOMNode
. So I’m not sure I understand the direction this project is taking in officially recommending its use. Presumably is until React makes its mind about thishostRef
thing. I’d still prefer to avoid the currently recommended solution to root refs since definitely all proposals seem to discourage the usefindDOMNode
.I like the
buttonRef
support for bothButton
andIconButton
. Looking forward to it. Thanks!