SlideShare a Scribd company logo
1 of 23
SUBJECTIVE BEST
PRACTICES FOR REACT
WOJCIECH PIĄTKOWSKI
ARCHITECTURE DOCUMENTATION
▸ explains how to write features
▸ a contract between team
members
▸ unified way of getting pieces
together
▸ discussion about
architecture in one place
▸ newcomers can be quickly
introduced to
ARCHITECTURE DOCUMENTATION
▸ can get outdated easily
▸ it’s a theory
▸ no one really reads it :)
SCAFFOLDING
▸ it’s also a documentation
▸ provides real code that
can be reused very
quickly
Scaffolding Reflux Component
SCAFFOLDING
▸ used often thus it’s likely
to get update when
something changes.
Scaffolding Reflux Component
SCAFFOLDING
▸ you can easily write your own to match often custom needs of a project
▸ or use one of third party projects
Use example of
https://www.npmjs.com/package/react-scaffold
▸ or even fork one of those on
github too much your needs
REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE
D
E
S
T
R
U
C
T
E
D
REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE
D
E
S
T
R
U
C
T
E
D
REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE
NOT
D
E
S
T
R
U
C
T
E
D
SMART AND DUMP COMPONENTS
Smart component
- displays three dump
components
- connects to a store through
this.store = chairsStore
- triggers action
chairActions.createChair
Dump component
- displays simple form
- has no state
SMART AND DUMP COMPONENTS
Smart component
- div’s witch css classes were
added
- css classes holds
presentational function which
belongs to to dump
components
- chairs.css is imported
which adds styles to
elements with css classes
- thanks to it smart
components now holds also
presentational
Let’s delegate presentational
function to somewhere else…
SMART AND DUMP COMPONENTS
Smart component
- It’s previous presentational
features were moved to
ChairsManger
- ChairsManger receives
all it’s content via children
prop …
…which makes wrapping each
child separately very hard
SMART AND DUMP COMPONENTS
Smart component
- all props that previously were
sent to each child dumb
component, are grouped and
passed to ChairsManager
- ChairsManager does all
the presentational work
Making ChairsManager more flexible - #1
SMART AND DUMP COMPONENTS
Dump component
- recevies all props
- passes each prop to specific
child dump component
- there are no unique for
ChairsManager props
- a lot of props are just passed
further, they don’t do real job
here
Making ChairsManager more flexible - #1
SMART AND DUMP COMPONENTS
Smart component
- there are no data passed to
ChairsManager that would
normally be passed to dump
components
- Dump components itself are
passed to ChairsManager
Making ChairsManager more flexible - #2
SMART AND DUMP COMPONENTS
Dump component
- receives props
elements/components
through props
- those props may be
interpreted as slots where
other can components can fit
- there are no „dead” props
Making ChairsManager more flexible - #2
This is simplified example. In
real project structures are more
complicated. General idea is to
avoid having too many props
passes to a component only to
have them passed further.
PRACTICAL TESTING OF REACT COMPONENTS
Deep snapshot testing
- those test are super simple to
write
- thanks to scaffolding they
may require zero effort
- they don’t test behavior
- rather than that they are
freezing already working
component
- when any of its children is
changed the snapshot test
will alert us
- action can be taken if
necessary or simply quick
update of snapshot test
STYLES ENCAPSULATIONS
- globals styles should be
avoided
- styles can be easily
encapsulated with a css
class specific to a component
- effort of creating a new style
file for each component can
be minimized thanks to
scaffolding
- minimizes chances of styles
collision (some extra
strategies can be added like
project related prefixes)
- keep styling close to related
component - easier to
maintain
ComponentName.less
HOT MODULE RELOADING + REACT
- Working with minimalistic
source maps - eval
- faster bundling
- no problems with source
maps while using HMR
- target of babel transpiration
does not have to be ES5
which means even faster
bundling
- http://kangax.github.io/compa
t-table/es2016plus/
support of ES2016+ is great!
- babel-preset-env picks
minimal number of
transformers base on
specified target, e.g chrome
v61
- dev: ‚eval’
thanks to that modules are
displayed with generated
code which is close to ES6+
HOT MODULE RELOADING + REACT
- code is ES2016+ without
classes
- of course no JSX
- but the code is in general
readable
- and probably sooner or later
it will be possible not to
transform ES6 classes
HOT MODULE RELOADING + REACT
- unfortunately due to possible
bug in react-hot-loader
transformation of ES6
classes is necessary
- react-hot-loader
currency is in beta version:
3.0.0-beta.7
what gives hope that problem
soon will be solved
LAST WORDS - LINTING
▸ the sooner it’s set up the better
▸ introducing some of useful linters rules in late phase of the project is either impossible or very hard to do
so
▸ for those rules which does not support —fix it’s still possible to automize thanks to additional transformers
e.g. ESLints’s rule sort-comp has a separate transformer in react-codemod
▸ configuration of ESlint can be
accelerated by picking one of
already prepared config, e.g.
eslint-config-airbnb,
eslint-config-eslint
The full list of most popular configs
can be found at Github:
dustinspecker/awesome-eslint
Best Practices for React Architecture Documentation

More Related Content

What's hot

Continuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksContinuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksTomaž Zaman
 
Serverless meetup - OpenWhisk overview and architecture
Serverless meetup - OpenWhisk overview and architectureServerless meetup - OpenWhisk overview and architecture
Serverless meetup - OpenWhisk overview and architectureSandeep Paliwal
 
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...Puppet
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 Tikal Knowledge
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Milindu Sanoj Kumarage
 
An introduction to Atlassian Bitbucket Pipelines
An introduction to Atlassian Bitbucket PipelinesAn introduction to Atlassian Bitbucket Pipelines
An introduction to Atlassian Bitbucket PipelinesDave Clark
 
Managing short lived Kubernetes (Production) deployments
Managing short lived Kubernetes (Production) deploymentsManaging short lived Kubernetes (Production) deployments
Managing short lived Kubernetes (Production) deploymentsHaufe-Lexware GmbH & Co KG
 
Continuous integration of_puppet_code
Continuous integration of_puppet_codeContinuous integration of_puppet_code
Continuous integration of_puppet_codeDevoteam Revolve
 
AWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAnton Babenko
 
Beginner's Guide to Angular 2.0
Beginner's Guide to Angular 2.0Beginner's Guide to Angular 2.0
Beginner's Guide to Angular 2.0All Things Open
 
Serverless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsServerless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsTung Nguyen
 
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawAws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawServerless User Group Poland
 
Using Docker in Production
Using Docker in ProductionUsing Docker in Production
Using Docker in ProductionCloudHero
 
Continuous integration using atlassian bamboo
Continuous integration using atlassian bambooContinuous integration using atlassian bamboo
Continuous integration using atlassian bambooAlexander Masalov
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deckJames Ford
 
Modern Tools for Building Progressive Web Apps
Modern Tools for Building Progressive Web AppsModern Tools for Building Progressive Web Apps
Modern Tools for Building Progressive Web AppsAll Things Open
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Maurice De Beijer [MVP]
 

What's hot (20)

Continuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksContinuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorks
 
Serverless meetup - OpenWhisk overview and architecture
Serverless meetup - OpenWhisk overview and architectureServerless meetup - OpenWhisk overview and architecture
Serverless meetup - OpenWhisk overview and architecture
 
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
PuppetConf 2016: Keynote: Pulling the Strings to Containerize Your Life - Sco...
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!
 
An introduction to Atlassian Bitbucket Pipelines
An introduction to Atlassian Bitbucket PipelinesAn introduction to Atlassian Bitbucket Pipelines
An introduction to Atlassian Bitbucket Pipelines
 
Managing short lived Kubernetes (Production) deployments
Managing short lived Kubernetes (Production) deploymentsManaging short lived Kubernetes (Production) deployments
Managing short lived Kubernetes (Production) deployments
 
Continuous integration of_puppet_code
Continuous integration of_puppet_codeContinuous integration of_puppet_code
Continuous integration of_puppet_code
 
AWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic intro
 
Beginner's Guide to Angular 2.0
Beginner's Guide to Angular 2.0Beginner's Guide to Angular 2.0
Beginner's Guide to Angular 2.0
 
Serverless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on JetsServerless Cron Jobs with Ruby on Jets
Serverless Cron Jobs with Ruby on Jets
 
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawAws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
 
Serverless
ServerlessServerless
Serverless
 
Using Docker in Production
Using Docker in ProductionUsing Docker in Production
Using Docker in Production
 
Continuous integration using atlassian bamboo
Continuous integration using atlassian bambooContinuous integration using atlassian bamboo
Continuous integration using atlassian bamboo
 
How Docker simplifies CI/CD
How Docker simplifies CI/CDHow Docker simplifies CI/CD
How Docker simplifies CI/CD
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
Modern Tools for Building Progressive Web Apps
Modern Tools for Building Progressive Web AppsModern Tools for Building Progressive Web Apps
Modern Tools for Building Progressive Web Apps
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18
 

Similar to Best Practices for React Architecture Documentation

From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...Alexander Dean
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014Rafe Colton
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...Docker, Inc.
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Webpack essentails - feb 19, 2020
Webpack essentails - feb 19, 2020Webpack essentails - feb 19, 2020
Webpack essentails - feb 19, 2020Jesse Colligan
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker, Inc.
 
Why you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectWhy you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectJoaquín Muñoz M.
 
Transformative Git Practices
Transformative Git PracticesTransformative Git Practices
Transformative Git PracticesNicola Paolucci
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureAdrian Otto
 
Serverless in production, an experience report (IWOMM)
Serverless in production, an experience report (IWOMM)Serverless in production, an experience report (IWOMM)
Serverless in production, an experience report (IWOMM)Yan Cui
 
Reuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldReuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldDmitri Zimine
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSRoss Kukulinski
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arpGary Pedretti
 
InfluxCloudi craft container orchestrator
InfluxCloudi craft container orchestratorInfluxCloudi craft container orchestrator
InfluxCloudi craft container orchestratorGianluca Arbezzano
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsDavid Amend
 
FireWorks overview
FireWorks overviewFireWorks overview
FireWorks overviewAnubhav Jain
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 

Similar to Best Practices for React Architecture Documentation (20)

From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
From Zero to Hadoop: a tutorial for getting started writing Hadoop jobs on Am...
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
Webpack essentails - feb 19, 2020
Webpack essentails - feb 19, 2020Webpack essentails - feb 19, 2020
Webpack essentails - feb 19, 2020
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Why you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectWhy you should consider a microframework for your next web project
Why you should consider a microframework for your next web project
 
Transformative Git Practices
Transformative Git PracticesTransformative Git Practices
Transformative Git Practices
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
 
SCSS Styleguide
SCSS StyleguideSCSS Styleguide
SCSS Styleguide
 
Serverless in production, an experience report (IWOMM)
Serverless in production, an experience report (IWOMM)Serverless in production, an experience report (IWOMM)
Serverless in production, an experience report (IWOMM)
 
Reuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldReuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless World
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOS
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 
InfluxCloudi craft container orchestrator
InfluxCloudi craft container orchestratorInfluxCloudi craft container orchestrator
InfluxCloudi craft container orchestrator
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
 
Kash Kubernetified
Kash KubernetifiedKash Kubernetified
Kash Kubernetified
 
FireWorks overview
FireWorks overviewFireWorks overview
FireWorks overview
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Best Practices for React Architecture Documentation

  • 1. SUBJECTIVE BEST PRACTICES FOR REACT WOJCIECH PIĄTKOWSKI
  • 2. ARCHITECTURE DOCUMENTATION ▸ explains how to write features ▸ a contract between team members ▸ unified way of getting pieces together ▸ discussion about architecture in one place ▸ newcomers can be quickly introduced to
  • 3. ARCHITECTURE DOCUMENTATION ▸ can get outdated easily ▸ it’s a theory ▸ no one really reads it :)
  • 4. SCAFFOLDING ▸ it’s also a documentation ▸ provides real code that can be reused very quickly Scaffolding Reflux Component
  • 5. SCAFFOLDING ▸ used often thus it’s likely to get update when something changes. Scaffolding Reflux Component
  • 6. SCAFFOLDING ▸ you can easily write your own to match often custom needs of a project ▸ or use one of third party projects Use example of https://www.npmjs.com/package/react-scaffold ▸ or even fork one of those on github too much your needs
  • 7. REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE D E S T R U C T E D
  • 8. REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE D E S T R U C T E D
  • 9. REACT COMPONENTS CLEARNESS - DESTRUCTING PROPS AND STATE NOT D E S T R U C T E D
  • 10. SMART AND DUMP COMPONENTS Smart component - displays three dump components - connects to a store through this.store = chairsStore - triggers action chairActions.createChair Dump component - displays simple form - has no state
  • 11. SMART AND DUMP COMPONENTS Smart component - div’s witch css classes were added - css classes holds presentational function which belongs to to dump components - chairs.css is imported which adds styles to elements with css classes - thanks to it smart components now holds also presentational Let’s delegate presentational function to somewhere else…
  • 12. SMART AND DUMP COMPONENTS Smart component - It’s previous presentational features were moved to ChairsManger - ChairsManger receives all it’s content via children prop … …which makes wrapping each child separately very hard
  • 13. SMART AND DUMP COMPONENTS Smart component - all props that previously were sent to each child dumb component, are grouped and passed to ChairsManager - ChairsManager does all the presentational work Making ChairsManager more flexible - #1
  • 14. SMART AND DUMP COMPONENTS Dump component - recevies all props - passes each prop to specific child dump component - there are no unique for ChairsManager props - a lot of props are just passed further, they don’t do real job here Making ChairsManager more flexible - #1
  • 15. SMART AND DUMP COMPONENTS Smart component - there are no data passed to ChairsManager that would normally be passed to dump components - Dump components itself are passed to ChairsManager Making ChairsManager more flexible - #2
  • 16. SMART AND DUMP COMPONENTS Dump component - receives props elements/components through props - those props may be interpreted as slots where other can components can fit - there are no „dead” props Making ChairsManager more flexible - #2 This is simplified example. In real project structures are more complicated. General idea is to avoid having too many props passes to a component only to have them passed further.
  • 17. PRACTICAL TESTING OF REACT COMPONENTS Deep snapshot testing - those test are super simple to write - thanks to scaffolding they may require zero effort - they don’t test behavior - rather than that they are freezing already working component - when any of its children is changed the snapshot test will alert us - action can be taken if necessary or simply quick update of snapshot test
  • 18. STYLES ENCAPSULATIONS - globals styles should be avoided - styles can be easily encapsulated with a css class specific to a component - effort of creating a new style file for each component can be minimized thanks to scaffolding - minimizes chances of styles collision (some extra strategies can be added like project related prefixes) - keep styling close to related component - easier to maintain ComponentName.less
  • 19. HOT MODULE RELOADING + REACT - Working with minimalistic source maps - eval - faster bundling - no problems with source maps while using HMR - target of babel transpiration does not have to be ES5 which means even faster bundling - http://kangax.github.io/compa t-table/es2016plus/ support of ES2016+ is great! - babel-preset-env picks minimal number of transformers base on specified target, e.g chrome v61 - dev: ‚eval’ thanks to that modules are displayed with generated code which is close to ES6+
  • 20. HOT MODULE RELOADING + REACT - code is ES2016+ without classes - of course no JSX - but the code is in general readable - and probably sooner or later it will be possible not to transform ES6 classes
  • 21. HOT MODULE RELOADING + REACT - unfortunately due to possible bug in react-hot-loader transformation of ES6 classes is necessary - react-hot-loader currency is in beta version: 3.0.0-beta.7 what gives hope that problem soon will be solved
  • 22. LAST WORDS - LINTING ▸ the sooner it’s set up the better ▸ introducing some of useful linters rules in late phase of the project is either impossible or very hard to do so ▸ for those rules which does not support —fix it’s still possible to automize thanks to additional transformers e.g. ESLints’s rule sort-comp has a separate transformer in react-codemod ▸ configuration of ESlint can be accelerated by picking one of already prepared config, e.g. eslint-config-airbnb, eslint-config-eslint The full list of most popular configs can be found at Github: dustinspecker/awesome-eslint