Top "React-proptypes" questions

This tag should be used if the question involves the type-checking system of React.

React proptype array with shape

Is there a built-in way to use proptypes to ensure that an array of objects being passed to a component …

arrays reactjs react-proptypes
ReactJs: What should the PropTypes be for this.props.children?

Given a simple component that renders its children: class ContainerComponent extends Component { static propTypes = { children: PropTypes.object.isRequired, } render() { return ( &…

reactjs jsx react-proptypes
React PropTypes : Allow different types of PropTypes for one prop

I have a component that receives a prop for its size. The prop can be either a string or a …

reactjs react-proptypes
Prop is marked as required in component, but its value is `undefined`

single.js : import React, { Component } from 'react'; import Details from '../components/details' import { ProgressBar } from 'react-materialize'; import { Route, Link } …

javascript reactjs react-router react-proptypes
PropTypes in a TypeScript React Application

Does using React.PropTypes make sense in a TypeScript React Application or is this just a case of "belt and …

reactjs typescript react-proptypes
PropTypes in functional stateless component

Without using class, how do I use PropTypes in functional stateless component of react? export const Header = (props) => ( <…

javascript reactjs react-props react-proptypes
React propTypes: objectOf vs shape?

What's the difference between PropTypes.objectOf and PropTypes.shape? In the PropTypes: // An object with property values of a certain …

reactjs react-proptypes
React: PropTypes in stateless functional component

In React, I wrote a stateless functional component and now want to add Prop Type validation to it. List component: …

reactjs react-proptypes
React linter airbnb proptypes array

I have the following PropTypes: SmartTable.propTypes = { name: React.PropTypes.string.isRequired, cols: React.PropTypes.array.isRequired, rows: React.PropTypes.…

reactjs airbnb react-proptypes linter
How to test React PropTypes through Jest?

I'm writing Jest tests for my React code and hoping to make use of/test the PropType checks. I am …

reactjs jestjs reactjs-testutils react-proptypes