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.

source code

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.

results matching ""

    No results matching ""