score:7

Accepted answer

Read this issue and this issue for discussions happened in the past. Just make props.error optional and check the value in your code. Otherwise, you would need to implement your own custom prop validation.

From the docs:

// 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])) {
    return new Error(
      'Invalid prop `' + propName + '` supplied to' +
      ' `' + componentName + '`. Validation failed.'
    );
  }
}

Related Query

More Query from same tag