question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose a decorator function for Redux containers.

See original GitHub issue

I propose exposing an additional function that returns the given component wrapped with the error boundary component. Much like connect() from the react-redux api.

When exposing the class alone, it lends it’s self to wrapping a component in JSX which isn’t a good fit in some scenarios. For example if a Redux container is referenced in a React Router route as a component reference there is no nice place to use this lib.

With a function as described we could do the following in our redux continers:

export default connect(mapStateToProps, mapDispatchToProps)(
   withErrorBoundary(Component, FallbackComponent, errorHandler)
)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
bvaughncommented, Oct 28, 2017

Just published 1.2.0 with support for this but you’ll need to switch away from arrow function to a regular function if you want to use it.

0reactions
bllingcommented, Oct 28, 2017

Get it, thanks for your great work again. ^_^

Read more comments on GitHub >

github_iconTop Results From Across the Web

testing state on decorated components · Issue #98 - GitHub
Is there a way to achieve the dual-export of a pure component and connected component using the @connect decorator syntax?
Read more >
The elegance of decorated Redux - CloudBoost
I prefer using decorators, because it allows me to write elegant and maintainable code. @connect({ mapStateToProps, mapDispatchToProps }) export ...
Read more >
Reducing our Redux code with React Apollo
This function returns an object with properties like variables , which supplies your variables to your query, and pollInterval , which allows ...
Read more >
Using recompose to achieve better separation of concerns in ...
Use recompose and higher order components to enhance functional components; Add new decorators to a composed decorator, keeping them small and ...
Read more >
React-Redux - Using multiple container decorators
New! Save questions or answers and organize your favorite content. Learn more. ... I have 3 containers: ... Each have their own page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found