Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When exporting with redux and refreshing browse, content disappears. #606

Closed
chris2kus31 opened this issue Apr 10, 2023 · 3 comments
Closed

Comments

@chris2kus31
Copy link

When connecting redux, it looses it connects when refreshing browser.

connect(mapStateToProps, mapDispatchToProps). Before refreshing screen, everything prints correctly, however, when you refresh your browse, all the content disappears and only the styles show on print preview.

My component is a class component and is exported as below

export default withStyles(s)(connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true })(ComponentToPrint))

@MatthewHerbst
Copy link
Owner

Hello. Would it be possible for you to please make a Codesandbox replicating your issue? It's very difficult to offer support otherwise

@chris2kus31
Copy link
Author

@MatthewHerbst ok, I will try but as in general, react-to-print works when exported with mapStateToProps and mapDispatchToProps ?

@MatthewHerbst
Copy link
Owner

I'm not a Redux expert so I can't speak too much about it, but react-to-print should work with any React code, regardless of what state management solution you use. I'm not sure if it's related, but we do have a paragraph about Redux in the README:

The connect method from react-redux returns a functional component that cannot be assigned a reference to be used within the content props' callback in react-to-print. To use a component wrapped in connect within content create an intermediate class component that simply renders your component wrapped in connect. See #280 for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants