Use propTypes in Reusable React Native Components

InstructorTyler McGinnis

Share this video with your friends

Send Tweet

In this React Native lesson, we will be creating a reusable Badge component. The component will also make use of propTypes to validate that its required data is being passed in when it is used.

Mel
~ 9 years ago

The github link is broken

Jason
~ 9 years ago
Christophe
~ 8 years ago

The component could be more reusable if you only pass the url, the name and the login instead of passing the whole userInfo object. Furthermore, you can check each type of your props intead of just checking that you have an object (which not guarantte that you will have url login and name keys + are strings) Just say'in. Good work.

Fahad
~ 7 years ago

This video is out of date (and few before it) have different code than what's in the github repo. It doesn't explain why this line is now required: import PropTypes from 'prop-types'; vs React.PropTypes etc.