News for hackers. Stuff that matters.
Re:React: Mixins Considered Harmful by thatswrong0 on Wednesday July 13, 2016 @02:59PM (#12088720)
I'm a fan of HOCs as well. My only problem with them is that I'm also a fan of shallow testing, and HOCs don't play nicely with shallow testing. I'm waiting on something like this (https://github.com/airbnb/enzyme/issues/250) to get implemented
Re:React: Mixins Considered Harmful by mg74 on Wednesday July 13, 2016 @04:14PM (#12089295)
Export every component like this:

export class MyComponent extends React.Component { ... }

export default SomeHOC(MyComponent)

And in your test simply import the non-hoc version:

import { MyComponent } from './mycomponent'

Now the HOC won't get in the way of your testing.

Re:React: Mixins Considered Harmful by coderzach on Wednesday July 13, 2016 @03:09PM (#12088792)
Why not just mock the HOC to be the identity fn? `(Component) => Component`
Re:React: Mixins Considered Harmful by eiriklv on Wednesday July 13, 2016 @03:36PM (#12089013)
This is my preferred approach as well - and it (anecdotally) works great, since you can then just manually inject any props/spies as needed like any other "dumb" component.

Edit: But he might be pointing to the testing of the actual HOCs/component decorating functions.