Skip to content
card background pattern
Level 1

React For Everyone

Unlock Full Course

$49.99 $39.99

Or

$24.99/Month

Default Props

Now that we understand how props work, we will take a look at default props. Default props are a default value that we can give our props in case a value is not given.

Downloads

Comments

User photo avatar
Greg/Shrinkray
6 days ago

I had the same experience. Cheers! Read about it: https://www.smashingmagazine.com/2020/08/mastering-props-proptypes-react/

Andy
9 days ago

Just had the same issue, and should have read the comments 🤦‍♂️

User photo avatar
London Dirt
12 days ago

@Aaron/Epic Nice ^^ I should always check lesson comments before staring puzzlingly at two lines of code for 10 minutes haha

User photo avatar
Aaron/Epic
20 days ago

If anyone else has issues with the PropTypes, it's because it has moved to it's own package.

Do this instead: remove the { PropTypes } from the React import line and add, import PropTypes from 'prop-types';

Everything else stays the same.

Something to say?

Become a Pro