Skip to content

Commit b9c5996

Browse files
LAITONENeps1lon
andauthored
Add possible element types that accept propTypes (#386)
Co-authored-by: Sebastian Silbermann <[email protected]>
1 parent e2c2fe2 commit b9c5996

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/docs/typechecking-with-proptypes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Greeting.propTypes = {
3030
};
3131
```
3232

33+
In this example, we are using a class component, but the same functionality could also be applied to function components, or components created by [`React.memo`](https://reactjs.org/docs/react-api.html#reactmemo) or [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref).
34+
3335
`PropTypes` exports a range of validators that can be used to make sure the data you receive is valid. In this example, we're using `PropTypes.string`. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. For performance reasons, `propTypes` is only checked in development mode.
3436

3537
### PropTypes {#proptypes}

0 commit comments

Comments
 (0)