krasimir/react-in-patterns

High-order component example does not return the enhanced component

dennisXZX opened this issue · 3 comments

In the High-order example, it seems we forget to return the enhanced component.

var enhanceComponent = (Component) => {
  class Enhance extends React.Component {
    render () {
      return (
        <Component {...this.props} />
      )
    }
  }
  
  // should we return the component here?
  return Enhance;
}

Actually, the example don't have the brackets after the => as you mentioned
image
So, the class is being returned correctly by the arrow function!

@dennisXZX There are any other example that I didn´t find?
If not, I think you can close this issue...

@infertux good call. I was going to work on this issue today but you were first. @dennisXZX is that example that you are referring to?

@infertux thanks guys! Sorry, I am new to React I didn't know that would return the class. TIL~ Thanks again. I will close the issue.