SlideShare a Scribd company logo
Atomic Design
with Next.js
Opinionated React
🤔 React is ever changing
🤔 There’s no one way to do things in React
🤔 People are trying to settle on a standard: React Router,
Redux
🤔 Next.js offers an opinionated React — a trade off with
big benefits
create-react-app
😍 Create React App is amazing!
😍 Use it! It saves so much time with not just the set up,
but because their config is so well done, you’ll get
better error messages and debugging
😍 Client side only though
Server-side rendering is hard
🐞 Next handles isomorphic / universal / bipartisan /
polyphonic rendering for you
🐞 Benefits of server rendering:
🐞 Better SEO
🐞 Faster user experience
🐞 Progressive: works in browsers without JavaScript
Next.js styling is different
🍩 <style jsx>…</style> inside component
🍩 Supports all of CSS: media queries, keyframe
animations, etc
🍩 Lean bundles and good hybrid server/client support
🍩 Only the styles for the current page will be served
Au Revoir React Router
🛤 Each page has its own file in /pages
🛤 export default your React component from each file
🛤 Nest files in folders for subpaths
🛤 Maintenance is easy: just rename or remove the file!
🛤 Params are currently a bit funny
Async loading is incredibly
easy
⚡ Just add getInitialProps() method to your page
component, and await anything needed
⚡ The data is loaded before the page renders, and you
receive it as props
⚡ Component.getInitialProps = async () => ({

items: await fetch(‘/api/items’)

})
Basic structure of Next.js
🌗 Components live in /components
🌓 Pages live in /pages
Similar concepts to Atomic
Design
Free book by Brad Frost — atomicdesign.bradfrost.com
Atomic design breaks down designs into a system of
components
Components have different granularity, building up
from atoms (the smallest indivisible pieces), to many
atoms as molecules, smarter organisms, and finally
templates & pages
Atomic Design with Next.js
Atomic structure
🍱 Atoms live in /components/atoms
🍱 Molecules live in /components/molecules
🍱 Organisms live in /components/organisms
🍱 Templates are pages before content is poured in
🍱 Templates/pages live in /pages
Simpler structure
🐺 Thought: Next.js promoted page components up
🐺 Atoms/molecules live in /components
🐺 Organisms live in /organisms
🐺 Pages live in /pages
Pure atoms & molecules
🐣 Atoms and molecules focus on rendering only
🐣 Makes testing easy: self contained, input → output
🐣 Implement using functional React components
🐣 Atom/molecule components live in /components
Smart organisms
🐙 Organisms bring atoms and molecules to life
🐙 Minimal responsibility for rendering
🐙 They focus on retrieving and sending data
🐙 API, GraphQL, local storage, etc
🐙 Organism components live in /organisms
Pages: lovely bunch of
organisms
- Organisms do most of the heavy lifting
- Pages rely on one or more organisms
- However, can be harder to get benefit of
getInitialProps() when composing multiple smart
components
- Page components live in /pages
How to get started?
🦄 yarn create next-app Unicorn3000
🦄 yarn dev to start the hot reloading server
🦄 yarn build to produce production-ready files
🦄 Uses Next.js 2.0
Next.js 3.0 is even better 🔥
🔥 Currently in beta
🔥 Worth using now!
🔥 Brings static exporting and dynamic importing
Create static websites
💃 Actually not just websites, static progressive web apps
with React goodness™
💃 All your async getInitialProps() will be pre-fetched
💃 Your client React app in the browser then continues the
dance
Dynamically import
🐝 Load JavaScript on demand with import()
🐝 Lighter and faster initial loads
🐝 Dynamic — decide what to load and when
Links
⚒ https://github.com/zeit/next.js
📙 http://atomicdesign.bradfrost.com/
Let me know what you make!
🏁 Twitter: @concreteniche
🏁 GitHub: @BurntCaramel
🏁 I teach at Coder Academy — coderacademy.edu.au
🏁 I make design tools @RoyalIcing — icing.space
🏁 Recently released react-organism — lightweight (< 2KB)
async state management

More Related Content

PDF
Prottとsketchとzeplinのススメ
PDF
ジャストシステムJava100本ノックのご紹介
PDF
オンボーディングにおける新卒・中途の違い freee株式会社 秋山詩乃
PDF
フロントからバックエンドまで - WebAssemblyで広がる可能性
 
PDF
小さく始める大規模スクラム
PDF
新規事業が対峙する現実からエンジニアリングを俯瞰する #devsumiB #devsumi
PDF
Mavenの真実とウソ
PDF
ゴリラテスト モバイルゲームのUIを自動的に検出・操作する モンキーテスト
Prottとsketchとzeplinのススメ
ジャストシステムJava100本ノックのご紹介
オンボーディングにおける新卒・中途の違い freee株式会社 秋山詩乃
フロントからバックエンドまで - WebAssemblyで広がる可能性
 
小さく始める大規模スクラム
新規事業が対峙する現実からエンジニアリングを俯瞰する #devsumiB #devsumi
Mavenの真実とウソ
ゴリラテスト モバイルゲームのUIを自動的に検出・操作する モンキーテスト

What's hot (8)

PDF
超簡単! インストールなしでRedmineを試す
PPTX
BBP BASU.pptx
PPTX
TechDojo_About_MQ_001.pptx
PDF
Androidの新ビルドシステム
PDF
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
PPTX
ENG484 by Ajarn Jomkaew
PDF
serviceクラスをやめようサブクラスを使おう
超簡単! インストールなしでRedmineを試す
BBP BASU.pptx
TechDojo_About_MQ_001.pptx
Androidの新ビルドシステム
從緊急事件 談 SRE 應變能力的培養 - DevOpsDays Taipei 2018
ENG484 by Ajarn Jomkaew
serviceクラスをやめようサブクラスを使おう
Ad

Similar to Atomic Design with Next.js (20)

PDF
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
PDF
Full Stack React Workshop [CSSC x GDSC]
PPTX
Frontend Workflow
PPTX
Full Stack_Reac web Development and Application
PPTX
Progressive Web Apps and React
PDF
PDF
next-230524050805-d1e22a49.pdferewrewrewrewr
PPTX
GDSC NITS Presents Kickstart into ReactJS
PDF
Isomorphic React Applications: Performance And Scalability
PPTX
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
PPTX
Presentation Tier optimizations
PDF
The complete-beginners-guide-to-react dyrr
PDF
Getting Started with React, When You’re an Angular Developer
PPTX
One code Web, iOS, Android
PDF
Performance and Scalability Art of Isomorphic React Applications
PPTX
ASP .Net Core SPA Templates
PPTX
20180518 QNAP Seminar - Introduction to React Native
PDF
Instant and offline apps with Service Worker
PPTX
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
PDF
Reactjs Basics
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
Full Stack React Workshop [CSSC x GDSC]
Frontend Workflow
Full Stack_Reac web Development and Application
Progressive Web Apps and React
next-230524050805-d1e22a49.pdferewrewrewrewr
GDSC NITS Presents Kickstart into ReactJS
Isomorphic React Applications: Performance And Scalability
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
Presentation Tier optimizations
The complete-beginners-guide-to-react dyrr
Getting Started with React, When You’re an Angular Developer
One code Web, iOS, Android
Performance and Scalability Art of Isomorphic React Applications
ASP .Net Core SPA Templates
20180518 QNAP Seminar - Introduction to React Native
Instant and offline apps with Service Worker
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
Reactjs Basics
Ad

Recently uploaded (20)

PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
web development for engineering and engineering
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Digital Logic Computer Design lecture notes
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Sustainable Sites - Green Building Construction
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
PPT on Performance Review to get promotions
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Lecture Notes Electrical Wiring System Components
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Geodesy 1.pptx...............................................
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
web development for engineering and engineering
CYBER-CRIMES AND SECURITY A guide to understanding
Digital Logic Computer Design lecture notes
Foundation to blockchain - A guide to Blockchain Tech
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Embodied AI: Ushering in the Next Era of Intelligent Systems
Sustainable Sites - Green Building Construction
UNIT 4 Total Quality Management .pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Model Code of Practice - Construction Work - 21102022 .pdf
PPT on Performance Review to get promotions
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Lecture Notes Electrical Wiring System Components
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
additive manufacturing of ss316l using mig welding
Geodesy 1.pptx...............................................
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf

Atomic Design with Next.js

  • 2. Opinionated React 🤔 React is ever changing 🤔 There’s no one way to do things in React 🤔 People are trying to settle on a standard: React Router, Redux 🤔 Next.js offers an opinionated React — a trade off with big benefits
  • 3. create-react-app 😍 Create React App is amazing! 😍 Use it! It saves so much time with not just the set up, but because their config is so well done, you’ll get better error messages and debugging 😍 Client side only though
  • 4. Server-side rendering is hard 🐞 Next handles isomorphic / universal / bipartisan / polyphonic rendering for you 🐞 Benefits of server rendering: 🐞 Better SEO 🐞 Faster user experience 🐞 Progressive: works in browsers without JavaScript
  • 5. Next.js styling is different 🍩 <style jsx>…</style> inside component 🍩 Supports all of CSS: media queries, keyframe animations, etc 🍩 Lean bundles and good hybrid server/client support 🍩 Only the styles for the current page will be served
  • 6. Au Revoir React Router 🛤 Each page has its own file in /pages 🛤 export default your React component from each file 🛤 Nest files in folders for subpaths 🛤 Maintenance is easy: just rename or remove the file! 🛤 Params are currently a bit funny
  • 7. Async loading is incredibly easy ⚡ Just add getInitialProps() method to your page component, and await anything needed ⚡ The data is loaded before the page renders, and you receive it as props ⚡ Component.getInitialProps = async () => ({
 items: await fetch(‘/api/items’)
 })
  • 8. Basic structure of Next.js 🌗 Components live in /components 🌓 Pages live in /pages
  • 9. Similar concepts to Atomic Design Free book by Brad Frost — atomicdesign.bradfrost.com Atomic design breaks down designs into a system of components Components have different granularity, building up from atoms (the smallest indivisible pieces), to many atoms as molecules, smarter organisms, and finally templates & pages
  • 11. Atomic structure 🍱 Atoms live in /components/atoms 🍱 Molecules live in /components/molecules 🍱 Organisms live in /components/organisms 🍱 Templates are pages before content is poured in 🍱 Templates/pages live in /pages
  • 12. Simpler structure 🐺 Thought: Next.js promoted page components up 🐺 Atoms/molecules live in /components 🐺 Organisms live in /organisms 🐺 Pages live in /pages
  • 13. Pure atoms & molecules 🐣 Atoms and molecules focus on rendering only 🐣 Makes testing easy: self contained, input → output 🐣 Implement using functional React components 🐣 Atom/molecule components live in /components
  • 14. Smart organisms 🐙 Organisms bring atoms and molecules to life 🐙 Minimal responsibility for rendering 🐙 They focus on retrieving and sending data 🐙 API, GraphQL, local storage, etc 🐙 Organism components live in /organisms
  • 15. Pages: lovely bunch of organisms - Organisms do most of the heavy lifting - Pages rely on one or more organisms - However, can be harder to get benefit of getInitialProps() when composing multiple smart components - Page components live in /pages
  • 16. How to get started? 🦄 yarn create next-app Unicorn3000 🦄 yarn dev to start the hot reloading server 🦄 yarn build to produce production-ready files 🦄 Uses Next.js 2.0
  • 17. Next.js 3.0 is even better 🔥 🔥 Currently in beta 🔥 Worth using now! 🔥 Brings static exporting and dynamic importing
  • 18. Create static websites 💃 Actually not just websites, static progressive web apps with React goodness™ 💃 All your async getInitialProps() will be pre-fetched 💃 Your client React app in the browser then continues the dance
  • 19. Dynamically import 🐝 Load JavaScript on demand with import() 🐝 Lighter and faster initial loads 🐝 Dynamic — decide what to load and when
  • 21. Let me know what you make! 🏁 Twitter: @concreteniche 🏁 GitHub: @BurntCaramel 🏁 I teach at Coder Academy — coderacademy.edu.au 🏁 I make design tools @RoyalIcing — icing.space 🏁 Recently released react-organism — lightweight (< 2KB) async state management