From the course: Web Components and Modularization: Practical Approaches

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Properties

Properties

- [Instructor] Most components receive data inputs and some pass that on to other components. This data takes the form of properties contained in a JavaScript object, often referred to as props. Most frameworks require all components to behave like pure functions with respect to properties, meaning the component cannot manipulate its own properties. This is a good rule to follow for all components, regardless of what type of component you're using. Properties are read-only. This means if the data passed to a component through a property needs to be updated or modified in some way internally in the component, it should be placed into a variable and then manipulated. If that property data needs to be passed on to something else, it should be put into a new property. Using a JavaScript object to send data to components allows us to send pretty much any data and any data type from simple primitives to complex rich data. That…

Contents