a-x- / react-easy-print

Powerful react component for easy printing
https://www.npmjs.com/package/react-easy-print
MIT License
87 stars 19 forks source link

avoid re-render onPrint #4

Closed a-x- closed 6 years ago

a-x- commented 6 years ago

Bug: lost every component's state on print

TODO

a-x- commented 6 years ago

Wow Use React16 portals https://hackernoon.com/using-a-react-16-portal-to-do-something-cool-2a2d627b0202?source=linkShare-c20285a847ce-1510861015

Don’t forget about Fall back

kevindekemele commented 6 years ago

Hello, so far your package has done good work for me, but indeed the state is lost. What do you mean exactly by using the portals?

Do I need to wrap a component which I use to portal with ?

Serjobas commented 6 years ago

API will be the same, we'll be using ReactDOM.createPortal under the hood

Serjobas commented 6 years ago

Fall back is something like this:

const el = window.document.createElement('div')
// el.id = 'react-easy-print-portal'
window.document.body.appendChild(el)
ReactDOM.render(..., el)
a-x- commented 6 years ago

📦 0.7.3-0