Skip to content

Instantly share code, notes, and snippets.

@asiniy
Last active July 3, 2018 15:19
Show Gist options
  • Save asiniy/1f6bdea8b1f58c58f294420fafa143c8 to your computer and use it in GitHub Desktop.
Save asiniy/1f6bdea8b1f58c58f294420fafa143c8 to your computer and use it in GitHub Desktop.
propTypes // Extending JavaScript with ease (beginner level tutorial)
import React from 'react'
import PropTypes from 'react-proptypes'
class MyComponent extends React.Component {
// render logic here
}
MyComponent.propTypes = {
collectorGroup: PropTypes.shape({
target_count: PropTypes.number.isRequired,
// a lot of other object properties here
})
}
export default MyComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment