-
-
Notifications
You must be signed in to change notification settings - Fork 348
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I would prefer it to throw.
Can't comment on deps update.
The throw would probably make sense if it wasn't possible to recover from it. |
I don't want to argue about this, but imo either it's a valid use case then it shouldn't warn (at least on production) or it's not and then it should throw (so I am forced to fix it). |
Is it allowed to use static members on memo components? Such as |
Ok, you are right. Changed it to throw. Sadly, the test is worthless in that case, but I kept it there for a future reference when it's possible to properly test errors in React. |
I think it's time to merge :) |
Fixes #709
The
React.memo
returns an object which isn't expected and is passed down toobserverClass
which assumed a class component, but it got a plain object without a prototype present.The solution works in a similar fashion as the one for
React.forwardRef
, but it simply removes additionalReact.memo
by accessing a wrapped function component and applyingobserver
to it. And it issues a warning.I've also installed
@testing-library/react
andjest-mock-console
to start modernizing tests slightly. There was a small hiccup as we have TS 2.6 in here, but the latest peer dep@types/yargs
is built on top of TS 3.5 (requiringunknown
). I had to force the older version there.