Skip to content

Instantly share code, notes, and snippets.

@Archakov06
Created May 30, 2018 18:34
Show Gist options
  • Save Archakov06/45fe1264dca019d48a0c32c49a56d356 to your computer and use it in GitHub Desktop.
Save Archakov06/45fe1264dca019d48a0c32c49a56d356 to your computer and use it in GitHub Desktop.
// плохо
function SFC({ foo, bar, children }) {
return <div>{foo}{bar}{children}</div>;
}
SFC.propTypes = {
foo: PropTypes.number.isRequired,
bar: PropTypes.string,
children: PropTypes.node,
};
// хорошо
function SFC({ foo, bar, children }) {
return <div>{foo}{bar}{children}</div>;
}
SFC.propTypes = {
foo: PropTypes.number.isRequired,
bar: PropTypes.string,
children: PropTypes.node,
};
SFC.defaultProps = {
bar: '',
children: null,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment