What are possible prop types?

Posted by Jennifer | Updated on

You can declare props with type or without type. But it is recommended to have prop types because it provides the documentation for the component and warns the developer for any incorrect data type being assigned.

As mentioned in the above code snippet, you can list props as an object, where the properties’ names and values contain the prop names and types, respectively.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers