growthmindsit

Component-Based Architecture

A component is a modular, portable, replaceable, and reusable set of well-defined functionality that encapsulates its implementation and exporting it as a higher-level interface.

A component can have three different views :

Characteristics of Components :

the advantages of using component based architecture :

React is a component-based library which divides the UI into little reusable pieces. In some cases, those components need to communicate (send data to each other) and the way to pass data between components is by using props.

Props” is a special keyword in React, which stands for properties and is being used for passing data from one component to another. But the important part here is that data with props are being passed in a uni-directional flow. (one way from parent to child) . Furthermore, props data is read-only, which means that data coming from the parent should not be changed by child components and Props are being passed to components like function arguments .

I can use props in react using this steps :

1- define an attribute and its value(data) . 2- pass it to child component(s) by using Props . 3- render the Props Data .