You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct me if I'm wrong but I haven't found an official way for a print-only component not being rendered.
Let's say that I have a component that depends on a plethora of props. Each prop change would trigger a re-render. It's a waste of effort if I'm not actually printing anything at the moment.
By subscribing to beforeprint and afterprint events I got a workaround but I cannot say I'm satisfied with it. It seems to violate separation of conerns.
Are there any plans on supporting this in the library?
The text was updated successfully, but these errors were encountered:
There is a reason for this behavior.
If PrintProvider would re-render the children (whole components tree)
state of components will be lost.
I thinked a few minutes right now and realized the solution:
PrintProvider should triggers target re-renderings for printOnly and some another components Through pubsub in the context
(Like ‘redux’ or ‘material ui’ theming does it in its connect/withStyles hocs).
Correct me if I'm wrong but I haven't found an official way for a print-only component not being rendered.
Let's say that I have a component that depends on a plethora of props. Each prop change would trigger a re-render. It's a waste of effort if I'm not actually printing anything at the moment.
By subscribing to beforeprint and afterprint events I got a workaround but I cannot say I'm satisfied with it. It seems to violate separation of conerns.
Are there any plans on supporting this in the library?
The text was updated successfully, but these errors were encountered: