Skip to content

Instantly share code, notes, and snippets.

Last active October 14, 2017 02:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
PropTypes and DefaultProps - Good Example
import propTypes from ‘prop-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