From the course: React Practice for Beginners: Build and Modify Basic Components

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Rendering UI elements with JSX

Rendering UI elements with JSX

- [Instructor] Let's talk about JSX. With React, we don't render plain strings or HTML directly. Instead, we work with JSX, which looks like HTML, but actually works inside JavaScript. With JSX, we can define UI right inside our components. It supports regular HTML tags and most regular HTML attributes, but on top of that, it also lets us include dynamic content in the JSX with curly braces. Enough talking. Let's look at an example that looks a lot like what we've just seen. So our welcome message is now rendering a static message, "Welcome to our movie app!" Let's update it to contain dynamic content. I'm going to create the constant app name, and I'm going to change that to movie app. Let's make this uppercase so you can actually tell the difference. Even though this is a hard coded variable, we're using a variable inside our JSX as soon as I'm going to include it right here between the curly braces. App name, and then, of course, I still want the exclamation points. And as you can…

Contents