The way of a Higher-Order Component
Anton Korzunov
191

const logProps => (WrappedComponent) =>
class extends React.Component {
componentWillReceiveProps(nextProps) {
console.log('Current props: ', this.props);
console.log('Next props: ', nextProps);
}
render() {
// Wraps the input component in a container, without mutating it. Good!
return <WrappedComponent {...this.props} />;
}
}
}

when I execute the code in the console of the Chrome why it comes the following error. In fact I can’t understand the `=>`.Is’t only used in react

> Uncaught SyntaxError: Missing initializer in const declaration
Like what you read? Give Ye Shiqing a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.