-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
childrenOfType incompatible with projects using react-hot-loader #39
Comments
Thanks for filing; I’m relatively sure this is just the nature of hot reloading interfering with the referential nature of JS - and i wouldn’t want to use brittle string comparisons, nor depend directly on RHL. Happy to leave this open while we brainstorm other solutions. |
Just noting this (in case it helps anyone who comes across this issue too):
Example: // `Table` uses `childrenOfType` to assert type `Row`
import Table, { Row } from '../example/Table';
// leads to a PropTypes validation error,
// when `react-hot-loader` is enabled:
const Foo = () => {
return (<Table><Row /></Table>);
} To fix the issue on a component-by-component basis: import { cold } from 'react-hot-loader';
import Table, { Row as _Row } from '../example/Table';
// avoids printing false errors in non-production env
// see https://github.com/airbnb/prop-types/issues/39
const Row = cold(_Row);
// no more PropTypes validation error,
// when `react-hot-loader` is enabled:
const Foo = () => {
return (<Table><Row /></Table>);
} |
childrenOfType
is currently incompatible with projects usingreact-hot-loader
because of this line:https://github.com/airbnb/prop-types/blob/master/src/childrenOfType.js#L8
According to the
react-hot-loader
docs,because React Hot Loader creates proxied versions of your components, comparing reference types of elements won't work
. It looks like they provide anareComponentsEqual
helper that checks for that (more details here), but I'm not sure if there's a good way to integrate with this.It looks like there is an open issue on
react-hot-loader
about this -- curious if you guys have any ideas for a solution or workaround: gaearon/react-hot-loader#304The text was updated successfully, but these errors were encountered: