Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equality check fails #80

Closed
elado opened this issue Oct 7, 2017 · 1 comment
Closed

Equality check fails #80

elado opened this issue Oct 7, 2017 · 1 comment

Comments

@elado
Copy link

elado commented Oct 7, 2017

I use the latest react-hot-loader. I have a component that looks roughly like this:

import Child from './Child';

function Parent({ children }) {
  invariant(
    Children.only(children).type === Child,
    'child must be of type Child'
  );
  ...
}

it checks that a child is of type Child. Thing is that the .type is the proxied type, while Child is the original Child, so equality fails.

When I debug and click on .type in Chrome it shows the generated code:

(function(factory,instantiate
/*``*/) {
return function Children() {
         return instantiate(factory, this, arguments);
      }
})

What's the best practice for comparing with a proxy? I could add a static prop and compare it but that seems dirty.

@elado
Copy link
Author

elado commented Oct 11, 2017

Dup of gaearon/react-hot-loader#304, closing

@elado elado closed this as completed Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant