Component and React
Component-based architecture focuses on the decomposition of the design into individual functional or logical components that represent well-defined communication interfaces containing methods, events, and properties.
The primary objective of component-based architecture is to ensure component reusability.
A component encapsulates functionality and behaviors of a software element into a reusable and self-deployable binary unit. There are many standard component frameworks such as COM/DCOM, JavaBean, EJB, CORBA, .NET, web services, and grid services.
A software component is a modular and portable piece of software that encapsulates well-defined functionality and is intended to interact with other components. It has a clearly defined interface and conforms to a recommended behavior. It can be deployed independently and is subject to composition by third parties.
A component can have 3 different views - object-oriented view, conventional view, and process-related view.
The object-oriented view considers a group of classes that work together to solve a problem. The analysis identifies problem domain classes, and the design identifies infrastructure classes, each with their own attributes and operations. The interfaces between classes are also defined to enable communication and cooperation.
The conventional view sees a program module as a functional element that contains processing logic, internal data structures, and an interface for invoking the component and passing data to it.
The process-related view involves building a system using existing components from a library, rather than creating each component from scratch. The software architecture is created, and components are selected from the library and integrated into the architecture.
Reusability, replaceable, not context specific, extensible, escapsulated, and independent are all characteristics of components
The advantages of using component-based design include ease of deployment, reduced cost, reusability, reliability, and system maintenance and evolution. Component-based design allows for independent development of components and flexible connectivity between them.
React is a library that follows a component-based approach to UI development, where the UI is divided into reusable components. In some cases, these components need to communicate with each other by passing data. To achieve this, React uses “props” or properties, which are a way to pass data from a parent component to a child component.
Prop is a keyword in react which means properties and is being used for passing data from one component to another. Props flows from top to bottom(Parent to Child).
Component
Prop Questions