ReactJS: Property Not Being Passed Down to Child

This is a funny one, coming from Anguar:

In react, attribute names in html are taken literally. In much the same way className is not class-name, when we pass attribute values down to children:

// wrong
<child is-priority={isPriority} />

// correct
<child isPriority={isPriority} />

The previous one will very literally add the property "is-priority" onto the child, instead of adding a  "isPriority".


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.