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









