From b1964ad8a7e254eb82a15ce6277409aa097e2132 Mon Sep 17 00:00:00 2001 From: Vitor Balocco Date: Sat, 5 Dec 2015 19:29:33 +0100 Subject: [PATCH] Clarify usage of `.propTypes` and `.defaultProps` when using stateless functional components I've seen some people unaware about the fact that you can still specify `.propTypes` and `.defaultProps` when you are defining a functional component by setting them as properties of the function. I thought clarifying this in the docs could help! --- docs/docs/05-reusable-components.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/05-reusable-components.md b/docs/docs/05-reusable-components.md index 337796b0c3..62b6295bfb 100644 --- a/docs/docs/05-reusable-components.md +++ b/docs/docs/05-reusable-components.md @@ -249,6 +249,7 @@ ReactDOM.render(, mountNode); ``` This simplified component API is intended for components that are pure functions of their props. These components must not retain internal state, do not have backing instances, and do not have the component lifecycle methods. They are pure functional transforms of their input, with zero boilerplate. +However, you may still specify `.propTypes` and `.defaultProps` by setting them as properties on the function, just as you would set them on an ES6 class. > NOTE: >