✳flâneur — a map of the web's best reading
Container/Presentational Pattern
patterns.dev · 1,252 words · saved by 1 readers
Enforce separation of concerns by separating the view from the application logic
In React, one way to enforce separation of concerns is by using the Container/Presentational pattern . With this pattern, we can separate the view from the application logic. Let’s say we want to create an application that fetches 6 dog images, and renders these images on the screen. DogImages.js DogImagesContainer.js 1 import React from "react" ; 2 3 export default function DogImages ( { dogs } ) { 4 return dogs . map ( ( dog , i ) => < img src = { dog } key = { i } alt = " Dog " /> ) ; 5 } Open CodeSandbox Ideally, we want to enforce separation of concerns by separating this process into two
Explore this link on the map →saved by
related reading
- Container/Presentational Patternpatterns.dev
- Building Bulletproof React Components - Shu Dingshud.in
- Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior · Mark's Dev Blogblog.isquaredsoftware.com
- You Might Not Need an Effect – Reactreact.dev
- Modularizing React Applications with Established UI Patternsmartinfowler.com
- Tao of React - Software Design, Architecture & Best Practices | Alex Kondovalexkondov.com
- Building data-centric apps with a reactive relational databaseriffle.systems
- Introducing Hooks – Reactlegacy.reactjs.org
- Redux Essentials, Part 1: Redux Overview and Concepts | Reduxredux.js.org
- Application State Management with Reactkentcdodds.com
- Tutorial: Tic-Tac-Toe – Reactreactjs.org
- Making Sense of React Server Components • Josh W. Comeaujoshwcomeau.com