Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created September 5, 2019 07:33
Show Gist options
  • Save joe-oli/5b7fb6f20ef6d3eaa0d01ddde5adfc4b to your computer and use it in GitHub Desktop.
Save joe-oli/5b7fb6f20ef6d3eaa0d01ddde5adfc4b to your computer and use it in GitHub Desktop.
random react notes
PropTypes.objectOf is used when describing an object whose properties are all the same type.
const objectOfProp = {
latitude: 37.331706,
longitude: -122.030783
}
// PropTypes.objectOf(PropTypes.number)
PropTypes.shape is used when describing an object whose keys are known ahead of time, and may represent different types.
const shapeProp = {
name: 'Jane',
age: 25
}
// PropTypes.shape({ name: PropTypes.string, age: PropTypes.number })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment