SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
Think components.
How to architect and build software components.
Ivan Babak
Software Architect, Frontend Software Engineer
Examples assume familiarity with React.
March 2017
Software architecture is
the structure of a software system,
the components and their properties,
and the protocols between the components.
What is ‘software architecture’?
A protocol is a system of rules of communication: how the elements talk to each other.
A structure is a set of elements: which elements belong to the system.
Every software engineer makes
architectural decisions daily.
Small or big. Often without realizing that.
Every software engineer makes architectural decisions daily.
● How to name a thing: a variable, an object field, a function, a class, a module.
○ Good architecture starts with correct naming. The name summarizes the purpose of the thing.
○ When the purpose changes, the name must change to reflect that.
● How to structure a thing: function arguments, objects, pieces of code.
● Where to put a thing: a variable, a function, a class, a module.
● How to organize the data flow in a piece of code.
○ Data flow is the path that certain pieces of data take through the program.
● How to organize the control flow in a piece of code.
○ Control flow is the path that the processor takes while executing the program.
● How to comment a piece of code.
○ Telling the reader why the code is written this way, not just what it does, helps to understand the
architecture.
What is a ‘component’?
A component is
a piece of software
responsible for a single thing,
serving a single purpose.
A component is like a function.
It has a context, a single task it performs, a name,
a set of inputs, outputs, and an internal behavior.
How to architect a component?
Like a function.
React components are functions, too.
How to architect a component? Like a function.
1. Context – what is the environment the component will live in?
2. Single responsibility and purpose.
3. Name – based on context, responsibility, purpose.
4. Inputs – the pieces of data required to fulfill the component’s responsibility.
5. Outputs – the pieces of data generated by the component.
6. Behavior, lifecycle – how the component will fulfill its responsibility.
How to architect a component. Case study: Tooltip.
1. Context
● React-based dashboard at a company called Acme.
● No existing tooltip.
2. Single responsibility & purpose
● Display a tooltip on mouse hover over an arbitrary UI
element.
3. Name `AcmeDashboardTooltip`
← Context → ← Responsibility and Purpose→
4. Inputs
● Reference UI element that will accept hover interaction.
● The tooltip content.
5. Outputs ● The React DOM element that implements the tooltip.
6. Behavior
● Has current state: visible / hidden.
● Changes state on mouse hover interaction.
● Requires positioning independent of ‘parent’ browser
DOM element.
The name and the inputs
are most important.
Do not hesitate to make long, descriptive names
of components and their inputs.
How to architect a component: inputs.
● Defining inputs is of utmost importance. It’s as important as the correct name.
● Understanding implicit inputs is even more important.
○ Examples: environment variables and APIs, cookies, etc.
● The fewer inputs, the better (more maintainable, future-proof, foolproof).
○ Restrict the inputs to just the essential parts of data required to fulfill the component’s
responsibility.
● Making an input optional increases the parameter space.
○ One more value to test. In JavaScript, even more than one.
● A good way to keep yourself from adding more inputs is to write a test suite
with every combination of their values.
How to architect a component: inputs. Examples.
● Function arguments.
● React props.
○ Can be treated as function arguments.
● React state.
● React context.
● Browser and platform environment, if accessed directly from a component.
● Cookies, storage, if accessed directly from a component.
`style` prop: 253 optional inputs.
Do not increase the parameter space of your components
by a close-to-infinite number of combinations of values.
`className` prop: even more inputs.
CSS cascading, hover, focus, media queries, ...
Thank you.
It’s time for a cup of coffee.

Contenu connexe

Similaire à Think components. March 2017

Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesFellowBuddy.com
 
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...Codemotion
 
Angular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereAngular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereCarlo Bonamico
 
NEr using N-Gram techniqueppt
NEr using N-Gram techniquepptNEr using N-Gram techniqueppt
NEr using N-Gram techniquepptGyandeep Kansal
 
Unit 2 Fundamentals of React -------.pptx
Unit 2 Fundamentals of React -------.pptxUnit 2 Fundamentals of React -------.pptx
Unit 2 Fundamentals of React -------.pptxkrishitajariwala72
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...Fwdays
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented languagefarhan amjad
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questionsAniketBhandare2
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesWalking Tree Technologies
 
React for non techies
React for non techiesReact for non techies
React for non techiesAmy Crimmens
 
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...Codemotion
 
Build Your Own Angular Component Library
Build Your Own Angular Component LibraryBuild Your Own Angular Component Library
Build Your Own Angular Component LibraryCarlo Bonamico
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperFabrit Global
 

Similaire à Think components. March 2017 (20)

Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
 
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
 
Angular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereAngular Rebooted: Components Everywhere
Angular Rebooted: Components Everywhere
 
NEr using N-Gram techniqueppt
NEr using N-Gram techniquepptNEr using N-Gram techniqueppt
NEr using N-Gram techniqueppt
 
Final ppt
Final pptFinal ppt
Final ppt
 
Unit 2 Fundamentals of React -------.pptx
Unit 2 Fundamentals of React -------.pptxUnit 2 Fundamentals of React -------.pptx
Unit 2 Fundamentals of React -------.pptx
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
Usable Software Design
Usable Software DesignUsable Software Design
Usable Software Design
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
 
L5 m256 block2_unit5
L5 m256 block2_unit5L5 m256 block2_unit5
L5 m256 block2_unit5
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree Technologies
 
Thoughtful Software Design
Thoughtful Software DesignThoughtful Software Design
Thoughtful Software Design
 
React for non techies
React for non techiesReact for non techies
React for non techies
 
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...
Carlo Bonamico, Sonia Pini - So you want to build your (Angular) Component Li...
 
Build Your Own Angular Component Library
Build Your Own Angular Component LibraryBuild Your Own Angular Component Library
Build Your Own Angular Component Library
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 

Dernier

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 

Dernier (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 

Think components. March 2017

  • 1. Think components. How to architect and build software components. Ivan Babak Software Architect, Frontend Software Engineer Examples assume familiarity with React. March 2017
  • 2. Software architecture is the structure of a software system, the components and their properties, and the protocols between the components. What is ‘software architecture’? A protocol is a system of rules of communication: how the elements talk to each other. A structure is a set of elements: which elements belong to the system.
  • 3. Every software engineer makes architectural decisions daily. Small or big. Often without realizing that.
  • 4. Every software engineer makes architectural decisions daily. ● How to name a thing: a variable, an object field, a function, a class, a module. ○ Good architecture starts with correct naming. The name summarizes the purpose of the thing. ○ When the purpose changes, the name must change to reflect that. ● How to structure a thing: function arguments, objects, pieces of code. ● Where to put a thing: a variable, a function, a class, a module. ● How to organize the data flow in a piece of code. ○ Data flow is the path that certain pieces of data take through the program. ● How to organize the control flow in a piece of code. ○ Control flow is the path that the processor takes while executing the program. ● How to comment a piece of code. ○ Telling the reader why the code is written this way, not just what it does, helps to understand the architecture.
  • 5. What is a ‘component’? A component is a piece of software responsible for a single thing, serving a single purpose.
  • 6. A component is like a function. It has a context, a single task it performs, a name, a set of inputs, outputs, and an internal behavior.
  • 7. How to architect a component? Like a function. React components are functions, too.
  • 8. How to architect a component? Like a function. 1. Context – what is the environment the component will live in? 2. Single responsibility and purpose. 3. Name – based on context, responsibility, purpose. 4. Inputs – the pieces of data required to fulfill the component’s responsibility. 5. Outputs – the pieces of data generated by the component. 6. Behavior, lifecycle – how the component will fulfill its responsibility.
  • 9. How to architect a component. Case study: Tooltip. 1. Context ● React-based dashboard at a company called Acme. ● No existing tooltip. 2. Single responsibility & purpose ● Display a tooltip on mouse hover over an arbitrary UI element. 3. Name `AcmeDashboardTooltip` ← Context → ← Responsibility and Purpose→ 4. Inputs ● Reference UI element that will accept hover interaction. ● The tooltip content. 5. Outputs ● The React DOM element that implements the tooltip. 6. Behavior ● Has current state: visible / hidden. ● Changes state on mouse hover interaction. ● Requires positioning independent of ‘parent’ browser DOM element.
  • 10. The name and the inputs are most important. Do not hesitate to make long, descriptive names of components and their inputs.
  • 11. How to architect a component: inputs. ● Defining inputs is of utmost importance. It’s as important as the correct name. ● Understanding implicit inputs is even more important. ○ Examples: environment variables and APIs, cookies, etc. ● The fewer inputs, the better (more maintainable, future-proof, foolproof). ○ Restrict the inputs to just the essential parts of data required to fulfill the component’s responsibility. ● Making an input optional increases the parameter space. ○ One more value to test. In JavaScript, even more than one. ● A good way to keep yourself from adding more inputs is to write a test suite with every combination of their values.
  • 12. How to architect a component: inputs. Examples. ● Function arguments. ● React props. ○ Can be treated as function arguments. ● React state. ● React context. ● Browser and platform environment, if accessed directly from a component. ● Cookies, storage, if accessed directly from a component.
  • 13. `style` prop: 253 optional inputs. Do not increase the parameter space of your components by a close-to-infinite number of combinations of values.
  • 14. `className` prop: even more inputs. CSS cascading, hover, focus, media queries, ...
  • 15. Thank you. It’s time for a cup of coffee.