liveBook · Manning

Modularity

As explained in React Quickly, Second Edition

A software architecture that organizes functionality into reusable, loosely coupled components with separated responsibilities.

React organizes web apps with a component-based architecture. Components use JavaScript, so functionality does not require a separate domain-specific language. section 1.1 section 1.1.1

Keep the logic for a piece of functionality close to the UI it controls. This approach works alongside React’s declarative views, which describe what should appear rather than spelling out every update step. section 1.1.1

if (user.session) {
 return <a href="/logout">Logout</a>;
} else {
 return <a href="/login">Login</a>;
}

This small login/logout choice keeps a JavaScript condition beside the UI it selects. It illustrates the approach, though it does not show how to divide a larger app into components. section 1.1.1

How React Quickly, Second Edition covers it

How deep it goes
Introduces component-based architecture and JavaScript components, but does not specify component boundaries or coupling rules.
Examples
Illustrates a JavaScript condition that selects a login or logout link.
What it assumes
Assumes basic JavaScript while introducing component-based architecture without requiring a domain-specific component language.
What you can do after
Evaluate/understand component-based organization as one reason React can simplify web-app development.
How it connects
Connects components with declarative views, JavaScript, and DOM abstractions.

Also explained in

Compare how 10 books explain modularity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of React Quickly, Second Edition. The section links point to the parts of the book it draws on.