react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

V4 -- Provide sub generator to create HOCs #263

Closed sthzg closed 7 years ago

sthzg commented 8 years ago

I would like to provide a sub generator to create higher order components, initially supporting the two architectures of hocs described here.

Props Proxy

function withBar(WrappedComponent) {
  return class Bar extends React.Component {
    render() {
      return <WrappedComponent {...this.props}/>
    }
  }
}

Extending from WrappedComponent

function withFoo(WrappedComponent) {
  return class Foo extends WrappedComponent {
    // ...
  }
}

Especially the second kind of architecture I am using quite often in a current project and I think it would be a good addition to the V4 generator. Would you be interested to merge it in? If positive, I would create a new directory src/hocs in the template repo (including a webpack alias and an update in the .eslintrc) and let the subgen create the files there.

sthzg commented 7 years ago

Closing due to inactivity.