Skip to content

Instantly share code, notes, and snippets.

@burgwyn burgwyn/GoodPropTypes.jsx
Last active Oct 14, 2017

Embed
What would you like to do?
PropTypes and DefaultProps - Good Example
import propTypes fromprop-types’;
const propTypes = {
findDelay: PropTypes.number,
columns: PropTypes.array,
loadCollapsed: PropTypes.bool,
tableHeight: PropTypes.number,
rowHeight: PropTypes.number,
defaultColWidth: PropTypes.number,
};
const defaultProps = {
findDelay: 500,
columns: [],
loadCollapsed: false,
tableHeight: 500,
rowHeight: 96,
defaultColWidth: 0
};
export default class YourComponent extends React.Component {
// Your code
}
YourComponent.propTypes = propTypes;
YourComponent.defaultProps = defaultProps;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.