From ccf00ccf08fd2f84f781c118dc7be196902a9699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Wed, 5 Feb 2014 15:05:41 -0800 Subject: [PATCH] Revert "Update propTypes documentation." This reverts commit b66fbde0a9538f84463ed6685b4cff02d84b79cb. --- docs/docs/05-reusable-components.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/05-reusable-components.md b/docs/docs/05-reusable-components.md index ff77e53e25..1819c38131 100644 --- a/docs/docs/05-reusable-components.md +++ b/docs/docs/05-reusable-components.md @@ -12,7 +12,7 @@ When designing interfaces, break down the common design elements (buttons, form ## Prop Validation -As your app grows it's helpful to ensure that your components are used correctly. We do this by allowing you to specify `propTypes`. `React.PropTypes` exports a range of validators that can be used to make sure the data you receive is valid. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. Note that for performance reasons `propTypes` is only checked in development mode. Here is an example documenting the different validators provided: +As your app grows it's helpful to ensure that your components are used correctly. We do this by allowing you to specify `propTypes`. `React.PropTypes` exports a range of validators that can be used to make sure the data you receive is valid. When an invalid value is provided for a prop, an error will be thrown. Here is an example documenting the different validators provided: ```javascript React.createClass({ @@ -34,14 +34,14 @@ React.createClass({ // JS's instanceof operator. someClass: React.PropTypes.instanceOf(SomeClass), - // You can chain any of the above with isRequired to make sure a warning is - // shown if the prop isn't provided. + // You can chain any of the above with isRequired to make sure an error is + // thrown if the prop isn't provided. requiredFunc: React.PropTypes.func.isRequired // You can also specify a custom validator. customProp: function(props, propName, componentName) { if (!/matchme/.test(props[propName])) { - console.warn('Validation failed!'); + throw new Error('Validation failed!') } } },