Last active
November 17, 2017 14:14
-
-
Save coryhouse/5cea28dc6639963d26803f84e5a14fcb to your computer and use it in GitHub Desktop.
Centralized propTypes declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// types/index.js | |
import { shape, number, string, oneOf } from 'prop-types'; | |
export const userType = shape({ | |
id: number, | |
firstName: string.isRequired, | |
lastName: string.isRequired, | |
company: string, | |
role: oneOf(['user', 'author']), | |
address: shape({ | |
id: number.isRequired, | |
street: string.isRequired, | |
street2: string, | |
city: string.isRequired, | |
state: string.isRequired, | |
postal: number.isRequired | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment