React JS - React Enlightenment JavaScript Syntax Extension (a.k.a, JSX) Basic React Components React Component Properties React Component State

Hire Website Designer

Learn how we work and how much your website will cost.

View category button.

Component Props More Than Strings

Before looking at validating props one needs to make sure they understand that a component prop can be any valid JavaScript value.

In the code example below I setup several default props containing several different JavaScript values.

Note how the propArray and propObject were overwritten with new values when the MyComponent instance is created.

The main take away here is that you are not limited to string values when passing prop values.