We define a custom function validator for the children property. Inside the function, we first use the built-in propTypes functions to check if children is an array of React elements. If the result of the validation is not an instance of Error, then we use the React Children's count utility method to know how many React elements were given and we return an error if the number of React elements in children is not 2.