Closed agentcooper closed 2 months ago
hey nice work
what's the advantage of using portals here?
Thank you.
At the moment I use ReactDOM.render to render highlights inside the existing PDF.js structure. The disadvantage is the loss of the context. If you use Redux in your app, the Highlight component won't have access to the store, so that you'll need to wrap Highlight in Provider manually.
Awesome.
For others who are curious:
"Features like context work exactly the same regardless of whether the child is a portal, as the portal still exists in the React tree regardless of position in the DOM tree." source: React docs on Portals
Makes sense in case of Redux but I agree it's a nice to have.
Great great work. Looking forward to hacking on it!
Code should use portals instead of calling
ReactDOM.render
insiderenderHighlights
.