Closed cmeeren closed 5 years ago
I didn't know about createRef
, do you need for a class component? As we want to focus on function components and hooks in Fable.React 5, I'd recommend using the useRef
hook (see the last example in this section of the blog post). Would that fit your needs?
No idea, I was just wondering for the purposes of Material-UI API design. MUI has some ref props that accept either obj
or ReactElement -> unit
, and I guess the obj
is then supposed to be the object returned by React.createRef
(but I might be wrong). It seems similar to ViewRef
in Fabulous, see example here.
I added the IRefHook
interface as the return type of useRef
and the RefHook
prop accepts it. I assume it must be the same (although the name IRefHook can be a bit misleading), can you give it a try?
I'm not currently in a position to try concrete stuff, this was just intended as clarifications for API design purposes of Material-UI (which I don't maintain; I'm just trying to clarify some stuff for https://github.com/mvsmal/fable-material-ui/issues/56).
Thanks so much for the prompt response and updates, though!
I added createRef
in 5.2.1, I hope it's ok :)
I'm reading up on React refs. I can't find any
createRef
in this repo. Are we supposed to only create refs using a callback? (Fine by me, I'd just like confirmation, as it influences the API design of ref props in Material-UI.)