Open oziniak opened 7 years ago
One option is to guard these checks against a NODE_ENV check, which should be optimized and dead-code eliminated by a properly configured Webpack build:
constructor(props, context) {
super(props, context);
if (process.env.NODE_ENV !== 'production' && context.tracking && context.tracking.process && process) {
console.error('[nyt-react-tracking] options.process should be used once on top level component');
}
}
Currently we encourage to use only one
process
on top level component, by making checks in constructor method of every tracking HoCCould these checks be performance consuming?
If there are several usages of
options.process
down a component tree desired behavior should be: