# Use Proptypes to define the Props you expect

**URL:** <https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885>\
**Category:** General\
**Created:** [April 26, 2018, 10:58pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885 "2018-04-26T22:58:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![novuw](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@novuw](https://forum.freecodecamp.org/u/novuw)\
**Post date:** [April 26, 2018, 10:58pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/1 "2018-04-26T22:58:49Z")

</div>

I have searched everywhere for two days. For some reason, my FCC console is stating “require is not defined,” and nothing is rendering. What is wrong with my code???

```auto
import React, { PropTypes } from 'react';

const Items = (props) => {
  return (<h1>Current Quantity of Items in Cart: {props.quantity}</h1>)
};

// change code below this line
Items.propTypes = {
  quantity: PropTypes.number.isRequired
};
// change code above this line

Items.defaultProps = {
  quantity: 0
};

class ShoppingCart extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return <Items quantity={3}/>
  }
};

```

Thank you so much. This has been a pain.

---

<div class="post-metadata">

**Author:** ![AdventureBear](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adventurebear/32/74786_2.png) [@AdventureBear](https://forum.freecodecamp.org/u/AdventureBear)\
**Post date:** [April 27, 2018, 1:10am UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/2 "2018-04-27T01:10:56Z")

</div>

What version I of react are you using? Prop types is now a separate installation in 16 and on

---

<div class="post-metadata">

**Author:** ![novuw](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@novuw](https://forum.freecodecamp.org/u/novuw)\
**Post date:** [April 27, 2018, 2:42pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/3 "2018-04-27T14:42:01Z")

</div>

I’m unsure. I’m just learning it on the FCC console right now.  
Thanks for the response!

---

<div class="post-metadata">

**Author:** ![AdventureBear](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adventurebear/32/74786_2.png) [@AdventureBear](https://forum.freecodecamp.org/u/AdventureBear)\
**Post date:** [April 27, 2018, 5:13pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/4 "2018-04-27T17:13:32Z")

</div>

What’s the FCC console, is that in the beta version? If it’s 16 or higher it needs to be imported specifically. This could be a sitewide issue then if others are having problems with it. Try another way, maybe codepen…where you have control over what libraries you’re including?

---

<div class="post-metadata">

**Author:** ![AdventureBear](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adventurebear/32/74786_2.png) [@AdventureBear](https://forum.freecodecamp.org/u/AdventureBear)\
**Post date:** [April 27, 2018, 5:14pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/5 "2018-04-27T17:14:05Z")

</div>

Or, just take the PropTypes out for now. it’s not required, (it’s just a good development practice) You can add it later.

---

<div class="post-metadata">

**Author:** ![novuw](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@novuw](https://forum.freecodecamp.org/u/novuw)\
**Post date:** [April 27, 2018, 5:21pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/6 "2018-04-27T17:21:53Z")

</div>

It’s in the beta version. How would I call it specifically?  
Thanks for the help bro!

---

<div class="post-metadata">

**Author:** ![AdventureBear](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adventurebear/32/74786_2.png) [@AdventureBear](https://forum.freecodecamp.org/u/AdventureBear)\
**Post date:** [April 27, 2018, 5:24pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/7 "2018-04-27T17:24:28Z")

</div>

1. I’m a sis, not a bro, lol.

2. You would need to include react libraries as scripts like this, and can do that from codepen. But if your’e in the FCC console in beta, i’m guessing that’s on the backend. I don’t even know if that’s the issue, but if you have some patience, it’s worth trying this in a different editor, or even locally.

Note I coped these from a tutorial…the current React version is 16.3.2

```auto
<script src="https://unpkg.com/react@15.6.1/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.6.1/dist/react-dom.js"></script>

```

> **[React - Versions](https://reactjs.org/versions)**
>
> A JavaScript library for building user interfaces

---

<div class="post-metadata">

**Author:** ![novuw](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@novuw](https://forum.freecodecamp.org/u/novuw)\
**Post date:** [April 27, 2018, 5:26pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/8 "2018-04-27T17:26:11Z")

</div>

Thanks so much! My bad.

---

<div class="post-metadata">

**Author:** ![raviloop](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/raviloop/32/66350_2.png) [@raviloop](https://forum.freecodecamp.org/u/raviloop)\
**Post date:** [May 31, 2018, 12:52am UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/9 "2018-05-31T00:52:07Z")

</div>

Just remove that import statement at the top, it will work.

---

<div class="post-metadata">

**Author:** ![riyadhrazzaq](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/riyadhrazzaq/32/97152_2.png) [@riyadhrazzaq](https://forum.freecodecamp.org/u/riyadhrazzaq)\
**Post date:** [August 15, 2018, 5:43am UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/10 "2018-08-15T05:43:24Z")

</div>

Importing didn’t work for me… I’ve used the `<script></script>` on FCC beta console and it worked. Thanks!

---

<div class="post-metadata">

**Author:** ![GitGirl](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/gitgirl/32/81182_2.png) [@GitGirl](https://forum.freecodecamp.org/u/GitGirl)\
**Post date:** [October 31, 2018, 4:43pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/12 "2018-10-31T16:43:00Z")

</div>

> [@AdventureBear](#):
>
> I’m a sis, not a bro, lol.

lol love this so much. 😂

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 6:00pm UTC](https://forum.freecodecamp.org/t/use-proptypes-to-define-the-props-you-expect/187885/13 "2021-01-16T18:00:41Z")

</div>

Closed on January 16, 2021, 6:00pm UTC


