liveBook · Manning

Separation of concerns

As explained in React Quickly, Second Edition

Separation of concerns is a design principle that isolates distinct responsibilities so each part of a system handles a focused concern.

Separation of concerns isolates unrelated responsibilities while keeping closely related items together. Each part should perform one focused concern and remain usable in different compositions. section 3.1.2

For interactive UIs, React applies the principle by keeping the UI description and JavaScript logic together in reusable components instead of splitting dependent templates and view logic across files. section 3.1.2 section 1.0

Apply the principle by:

  • Keeping related UI structure and behavior together when separating them would make each part depend on the other. section 3.1.2
  • Giving components focused responsibilities, such as displaying a timer list, running an individual timer, or managing a submission form. section 12.6
  • Allowing components to communicate through interfaces and callbacks without requiring one component to know the other's internal work. section 12.6

A focused JSX component

const title = <h1>Hello</h1>; JSX keeps the description of this UI element beside its JavaScript context, then transpiles it into regular JavaScript. section 3.1.2

Figure 3.1 JSX is transpiled into regular JavaScript.
03-01

Trace how JSX becomes regular JavaScript before execution. section 3.1.2

How React Quickly, Second Edition covers it

How deep it goes
Defines focused responsibilities, contrasts template splitting, and traces three timer state layers without deeper implementation detail.
Examples
Uses JSX headings, reusable form controls, autocomplete components, and a timer application with independent component responsibilities.
What it assumes
Connects the principle to HTML, CSS, JavaScript, JSX, and React without requiring a separate framework history.
What you can do after
Build reusable React UI components with focused responsibilities and callback-based interfaces.
How it connects
Ties separation of concerns to JSX, React, reusable UI components, component state, callbacks, and accessibility.

Also explained in

Compare how 22 books explain separation of concerns →

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.