BAD DOCS BAD DOCS BAD DOCS BAD DOCS
What is componentRef?
Check the React docs : https://reactjs.org/docs/refs-and-the-dom.html
How Can i Pass a function that return a div and h2 to print it?
is ComponentToPrint must be an Class?
@ikosar yes. The library requires the use of refs to work, and functional components do not have refs.
From the React docs:
You may not use the ref attribute on function components because they don鈥檛 have instances.
If you know of a better way to write this library that without refs we'd be happy to hear it. Thanks!
Dear MatthewHerbst
Many thanks to your complete answer
I read the document but I still can not understand how I can define the componentRef.
and I have another question, I'm using FabricUI Dialog component, can I print the content of the dialog?
@AhmadiRamin what don't you understand? It's just any React ref.
@MatthewHerbst Thanks Matthew, I figured it out and it's working now.
@ikosar are you still having problems?
Most helpful comment
I read the document but I still can not understand how I can define the componentRef.
and I have another question, I'm using FabricUI Dialog component, can I print the content of the dialog?