Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
JSX Specifying Attributes | Getting Started: JSX
Introduction to React

JSX Specifying Attributes

In order to specify attributes to the elements we can use the syntax: <element attribute=value></element>

It is very similar to HTML though it is important to note that the names of attributes are sometimes different and follow camelCase convention.

For example class in JSX is className instead, and tabindex is tabIndex.

We can also assign dynamic attributes by embedding an expression:

Note

We don't put quotes around curly braces when embedding a JavaScript expression in an attribute.

What is the correct way to specify the class attribute to a JSX element?

Select the correct answer

Everything was clear?

Section 2. Chapter 4
course content

Course Content

Introduction to React

JSX Specifying Attributes

In order to specify attributes to the elements we can use the syntax: <element attribute=value></element>

It is very similar to HTML though it is important to note that the names of attributes are sometimes different and follow camelCase convention.

For example class in JSX is className instead, and tabindex is tabIndex.

We can also assign dynamic attributes by embedding an expression:

Note

We don't put quotes around curly braces when embedding a JavaScript expression in an attribute.

What is the correct way to specify the class attribute to a JSX element?

Select the correct answer

Everything was clear?

Section 2. Chapter 4
some-alt