Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add named function snippets #46

Merged
merged 4 commits into from
Jun 24, 2018
Merged

Add named function snippets #46

merged 4 commits into from
Jun 24, 2018

Conversation

kylemh
Copy link
Contributor

@kylemh kylemh commented May 11, 2018

Without some babel configuration, it's impossible to list prop types at the top of the file when using arrow function components. Many React developers like to use named functions so that prop type definitions can exist at the top of the file - acting as a sort of documentation.

These two snippets will generate the following:

import React from 'react';

function Footer(props) {
  return (
    <div>
      
    </div>
  );
};

export default Footer;
import React from 'react';
import PropTypes from 'prop-types';

Footer.propTypes = {
  
};

function Footer(props) {
  return (
    <div>
      
    </div>
  );
};

export default Footer;

@kylemh kylemh changed the title Add named function options Add named function snippets May 11, 2018
@xabikos xabikos merged commit fee74d9 into xabikos:master Jun 24, 2018
@kylemh kylemh deleted the patch-1 branch June 26, 2018 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants