Open fahad19 opened 7 years ago
We've been doing this as part of the FareKeep implementation, with the only difference being that we do a default
export on the observed component.
Good idea. I'm also thinking that making observed component default export is better, just as @reaktivo mentioned. Because then regular code imports the component as usual, while for unit tests there are some additional handles.
Currently
Most observed components are written like this:
And to use it somewhere else, we can just import and embed it in JSX:
Proposal
To make unit testing easier and yet keep related functions in the same file, a new structure can be considered:
To import and use elsewhere:
This also makes unit testing easier for the components: