1

I have run into a weird issue in React. Normally when you set className it gets converted to class, but when you also set the is attribute, this does not happen. You have to use class instead. Is there a reason behind this behavior?

<div key={this.props.key} className='A B' is='x-custom-web-component'></div>
3
  • Can you give a code example of what you mean. What do you mean by the is attribute? Commented Mar 25, 2016 at 3:39
  • How are you creating your components? What version of React? Commented Mar 25, 2016 at 4:26
  • I'm using react 0.14.7. I'm experimenting with using custom elements from webcomponents in a react application. Commented Mar 25, 2016 at 5:03

1 Answer 1

1

With web-components React passes all props directly as attributes. This is because a web-component could use an attribute called 'classname' and 'class' for different things. One exception is style which still uses an object.

Sign up to request clarification or add additional context in comments.

1 Comment

So this is a special case behavior?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.