react-jobs icon indicating copy to clipboard operation
react-jobs copied to clipboard

Passing job state to the wrapped component

Open oyeanuj opened this issue 8 years ago • 0 comments

Hi @ctrlplusb, As I was using this library, I ended up making another modificaiton that I thought I'd bring up here incase you think it is helpful to include in the library or is helpful to anyone else.

The components that I had built tend to handle loading states and error states within themselves based on their own custom logic for more finegrained loading and error handling experience. So, I ended up needing the entire jobState passed to the WrappedComponent rather than only the jobResult. This meant, I didn't need to add LoadingComponent/ErrorComponent and instead each component made its own decision (sometimes even child components made decisions for their own sections).

Here is the commit in question: https://github.com/oyeanuj/react-jobs/commit/b1c2c811fd03bf2d050cc6176cb4ece0a1ff5de3

Do you think this or similar prop should be part of this library? One clean alternative that would be a breaking change would be to pass the entire job state to the wrapped component always without needing to introduce a new prop to enable it?

oyeanuj avatar Nov 30 '17 23:11 oyeanuj