FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
One component, two layouts: the dual view pattern in React
NewsWeb Development

One component, two layouts: the dual view pattern in React

via Dev.to ReactSammii1mo ago

One component, two layouts: the dual view pattern in React My portfolio has two completely different layouts. A grid of cards that open into modals. A full-screen vertical carousel with snap scrolling. They look nothing alike and behave nothing alike. They share one component and one data file. That pattern is worth writing about. The shared data layer Everything starts with projects.js : a flat array of objects, one per project. Four fields each: id , title , techStack , info . Both views import it directly. Neither knows the other exists. export const projects = [ { id : " lunary " , title : " Lunary " , techStack : " Next.js, Prisma, PostgreSQL " , info : " A real-time astrology platform with birth charts, transit tracking, and synastry analysis. " , }, // ... ]; The id doubles as the GitHub repo slug, the image filename key, and the React list key. One field, three uses. That's a different article — the point here is that a single import drives both views. ProjectItem: one componen

Continue reading on Dev.to React

Opens in a new tab

Read Full Article
14 views

Related Articles

C Preprocessor tricks, tips, and idioms
News

C Preprocessor tricks, tips, and idioms

Lobsters • 4d ago

Upgrade your NAS storage with this WD 2TB SSD - now $240 off during Amazon's Spring Sale
News

Upgrade your NAS storage with this WD 2TB SSD - now $240 off during Amazon's Spring Sale

ZDNet • 4d ago

This car charger is a must for long road trips - and it's cheap
News

This car charger is a must for long road trips - and it's cheap

ZDNet • 4d ago

Top 10 Best Government
News

Top 10 Best Government

Medium Programming • 4d ago

The Year Software Engineering Stopped Feeling Like Software Engineering
News

The Year Software Engineering Stopped Feeling Like Software Engineering

Medium Programming • 4d ago

Discover More Articles