silverlight513 silverlight513 - 1 year ago 88
React JSX Question

What would the propType be of a JSX prop in react

In react you can set the propType of the props that come into a component. For one of my props I want the value to either be null or a line of JSX. The React docs don't cover what propType should be used for JSX.

When testing this I found that it wouldn't throw errors when using the propTypes of object or element. When using another such as symbol I would get an error that said it was an object. If it was an object surely it should complain when it's an element.

What is the correct propType for JSX?

Answer Source

Try using this propType...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download