Browse Source

[Docs] new PropType behavior

(Killed the TODOs since they're no longer valid).
main
Cheng Lou 11 years ago
parent
commit
ff6cb41f09
  1. 10
      docs/05-reusable-components.md
  2. 4
      docs/ref-03-component-specs.md

10
docs/05-reusable-components.md

@ -57,17 +57,19 @@ React.createClass({
fontSize: React.PropTypes.number
}),
// 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 a warning
// is shown if the prop isn't provided.
requiredFunc: React.PropTypes.func.isRequired,
// A value of any data type
requiredAny: React.PropTypes.any.isRequired,
// You can also specify a custom validator.
// You can also specify a custom validator. It should return an Error
// object if the validation fails. Don't `console.warn` or throw, as this
// won't work inside `oneOfType`.
customProp: function(props, propName, componentName) {
if (!/matchme/.test(props[propName])) {
console.warn('Validation failed!');
return new Error('Validation failed!');
}
}
},

4
docs/ref-03-component-specs.md

@ -53,8 +53,6 @@ object propTypes
The `propTypes` object allows you to validate props being passed to your components. For more information about `propTypes`, see [Reusable Components](/react/docs/reusable-components.html).
<!-- TODO: Document propTypes here directly. -->
### mixins
@ -64,8 +62,6 @@ array mixins
The `mixins` array allows you to use mixins to share behavior among multiple components. For more information about mixins, see [Reusable Components](/react/docs/reusable-components.html).
<!-- TODO: Document mixins here directly. -->
### statics

Loading…
Cancel
Save