Failed prop type: Invalid prop `children` of type `string` supplied to `DetailField`, expected `object`

Karan Patokar

when

children: PropTypes.string

It's showing error

Failed prop type: Invalid prop `children` of type `object` supplied to `DetailField`, expected `string`.

when

children: PropTypes.object

It's showing error

Failed prop type: Invalid prop `children` of type `string` supplied to `DetailField`, expected `object`.

And if I try to do this, I don't know if it's valid or not

children: PropTypes.object && PropTypes.string

It shows

Failed prop type: Invalid prop `children` of type `object` supplied to `DetailField`, expected `string`.

What should I do?

twils0

If I understand you correctly, you want to check for one of two prop types, object or string:

children: PropTypes.oneOfType([
  PropTypes.object,
  PropTypes.string,
])

Please check out the prop-types README for more information.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Failed prop type: Invalid prop `match.params` of type `object` supplied to `Page`, expected `string`

GraphQL: Warning: Failed prop type: Invalid prop `query` of type `object` supplied to `StaticQuery`, expected `string`

Warning: Failed prop type: Invalid prop `items[0]` of type `string` supplied to `ImageGallery`, expected `object`

Failed prop type: Invalid prop `answer` of type `string` supplied to `AnswerItem`, expected `object`

Failed prop type: Invalid prop `children` of type `array` supplied to `GlobalState`

GETTING ERROR : Warning: Failed prop type: Invalid prop `children` supplied to `Form`, expected a ReactNode

Failed prop type: Invalid prop `children` supplied to `ForwardRef(Select)`, expected a ReactNode

React router error (Failed prop type: Invalid prop `children` supplied to `Switch`, expected a ReactNode.)

Warning: Failed prop type: Invalid prop `children` supplied to `ForwardRef(Select)`, expected a ReactNode

React Snapshot testing with jest - Failed prop type: Invalid prop `children` of type `string` supplied

Failed prop type: Invalid prop `opacity` of type `object` supplied to `RCTView`

React Warning: Failed prop type: Invalid prop of type `Object` supplied

Warning: Failed prop type: Invalid prop `data` of type `object` supplied to `Carousel`, expected `array`

Failed prop type: Invalid prop `onClick` of type `object` supplied to `ButtonBase`, expected `function`

Failed prop type: Invalid prop `onClick` of type `object` supplied to `Button`, expected `function`

Why do I get Failed prop type: Invalid prop `onAnimationFinish` of type `object` supplied to `LottieView`, expected a `funtion`

Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function`

Warning: Failed prop type: Invalid prop `value` of type `number` supplied to `TextInput`, expected `string`

Warning: Failed prop type: Invalid prop `defaultValue` of type `string` supplied to `AutoCompleteSearch`, expected `function`

Failed prop type: Invalid prop `responsive` of type `string` supplied to `Image`, expected `boolean`

Failed prop type: Invalid prop `to` supplied to `Redirect`

React Native error Failed prop type: Invalid prop `children` of type `array` supplied to `Overlay`,

Invalid prop `component` of type `object` supplied to `Route`, expected `function`

Invalid prop: type check failed for prop "cellClass". Expected String with value "[object Object]", got Object

[Vue warn]: Invalid prop: type check failed for prop "productCartData". Expected Object, got String with value "[object Object]"

Failed prop type: Invalid prop of type `function` supplied expected a single ReactElement

Warning: Failed prop type: Invalid prop `open` of type `function` supplied to `ForwardRef(Dialog)`, expected `boolean`. at Dialog

Invalid prop type supplied

Invalid prop `verseObj.version_id` of type `string` supplied to `VerseForm`, expected `object`