Search code examples
reactjsreact-proptypes

React PropTypes DOM element?


How do I mark a property as having to be a DOM element?

This page says that PropTypes.element is actually a React element, so what's the equivalent for DOM element?


Solution

  • PropTypes.instanceOf(Element)
    

    Is working for me. You can also add isRequired:

    PropTypes.instanceOf(Element).isRequired