CVarisco / create-component-app

Tool to generate different types of React components from the terminal. 💻
MIT License
859 stars 58 forks source link

Proposal: componentMethods option - unintuitive behavior #69

Open vemv opened 6 years ago

vemv commented 6 years ago

Hi again!

I tried setting "componentMethods": ["render"], in my .ccarc.

This results in the following:

class template extends Component {
    constructor(props) {
        super(props)
    }

    render(){}

    render() {
        return (
            <div className="template"></div>
        );
    }
}

I see two issues here:

Cheers - Victor

CVarisco commented 6 years ago

Hi @vemv

Before all, thanks for your support and alert 👍

Anyway, the componentMethods as you can see isn't exclusive and add extra methods to the component (and doesn't check if exist or not one method inside the list). For now, I can propose a PR where I can change the documentation that explicit these. And for the future, we can think which is the best behaviour for that option.

What do you think? 😃

CVarisco commented 6 years ago

Currently, I'm working on the v2 and I can consider changing that option to accept every method to include in the components. Thank you for your proposal and help 👍