Jon Rumsey

An online markdown blog and knowledge repository.


Project maintained by nojronatron Hosted on GitHub Pages — Theme by mattgraham

Components and React

What Is A Component

Components are individual, functional bundles of code that contain methods, properties, and perhaps events.

They specific a specific set of functionality or API that they export, and their prime directive is to simply perform on those APIs very well and that is it.

Component Views

Object-oriented: Component is viewed as a set of well coordinated classes. Communication between classes are defined as an interface.

Conventional: Components is viewed as a module or functional library with an interface allowing data to be passed between it and its dependants. All functionality and processing are fully encapsulated in the module.

Process-related: Components are built on top of existing components, maintained as a Library.

UI Components: Contain the controls and functions that can be used within other functions to manage aspects of the user interface.
Resource Intensive: Components activated using a JIT approach.
Invisible/Enterprise: Internet WebApps and other applications like EJB, DotNET, CORBA, etc.

Component Characteristics

Resuable: Some components are designed for very specific tasks, other are designed to be used in other scenarios. Either way, whenever a component can be used, it should.

Replaceable: Substitution should be allowed and possible (with minimal or no code refactoring).

Not Context Specific: Designed to operate in different environments.

Extensible: New behavior can be added by building-on to the existing Component.

Encapsulated: Details of "under the hood" processing and etc are hidden from the caller, as they are not necessary to meet the purpose of the Component nor the goals of the App that is using it.

Independent: Components should rely on as few other Components or Libraries as possible.

Component Design Principles

Guidelines for Component Design and Creation:

Component Design Guidelines

How Does This Apply To React

React is a component-based Library [itnext.io article (see link below)].

About Props

They:

Q and A

What is a Component? Individual, functional bundles of code that contain methods, properties, and perhaps events. The functionality is well-defined, and fully encapsulated into the software object. Components are tightly specified and guaranteed to provide the interface and functionality as it is described.

What are the characteristics of a component? Reusability, Replacability, Context-insensitive, Extensible, Encapsulated, and Independent.

What are the advantages of using component-based architecture?

What is "props" short for? Props are how components pass data between each other. Props is a React keyword that stands for properties.

How are props used in React? Props are used to pass data within a React application, from one component to another.

What is the flow of props? Prop Data flows one-way, from Parent to Child.

References

Component Based Architecture webpage
What Is Props and How To Use In React webpage

Back to readme.md