Closed
Description
Thank you for this wonderful library, it's helped me set up React in Rails when I'm new to Rails. It's especially nice to have rails g react:component
for quickly creating new components. I'm using a lot of functional components in my project, though, so it's not as useful.
What about adding an option to make it a functional component? Something like rails g react:component --func
or rails g react:component --function
.
This would create:
import React from "react"
import PropTypes from "prop-types"
function SomeComponent() {
return (
<React.Fragment>
Example: {this.props.example}
</React.Fragment>
);
}
SomeComponent.propTypes = {
example: PropTypes.text
};
export default SomeComponent