From the course: React for Web Designers

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Everything is components and elements

Everything is components and elements - React.js Tutorial

From the course: React for Web Designers

Everything is components and elements

- [Instructor] When you're writing JavaScript with React pretty much everything is a component, and those components are made up of elements. In this video we'll talk about what might interest us about components. Components are the building blocks of a user interface at whatever level of granularity you think is appropriate. You'll usually have one big one containing everything else, and then it's up to you to figure out what the others should be within that. Defining a React component means writing a function or a class. We'll look at which you'll use in more detail later, but for now, functions are simpler and lighter, also a little less powerful. Classes can do everything that React supports, but are a new feature of ES6, so you might need a polyfill called create-react-class to help you with this. To get started you can usually just work with functions and then enhance them as you need to later. Components are meant to be reusable by you for certain, and maybe by others as well…

Contents