How it works...

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.47.203