SlideShare a Scribd company logo
1 of 17
The Public Parts
Employer: Unicon, Inc
Role: Sr. UI Developer
Blog: blog.bradleygore.com
Family: Carolina & Garrison
About Me
Mixin’ It Up
With React Mixins -Bradley Gore
The Problem
HELP!
I have potential for dynamically
added/removed form-fields, but need for
my form component to know whether or
not it can submit.
PS: Also must work in all browsers, be beautiful, easy to use, and done ASAP.
Solution: Form Component where Inputs are “Registered”
Submit
Snap-in Form
Text Input Field registerWithForm()
Number Input Field deRegisterFromForm()
Field Container
What are React mixins?
Mixins are a way for totally separate
components to have common
functionality...
What are React mixins?
Mixins are a way for totally separate
components to have common
functionality...
...and still remain totally separated
even after the mixing is done.
Form Component
● inputs
○ empty object placeholder for registered inputs to live
● registerInput(input)
○ takes the input being registered. Inputs are expected to
have a name, as that’s the key in the inputs hash.
● deRegisterInput(name)
○ takes the de-registered input’s name, and deletes that key
from this.inputs
● updateValidity()
○ sets the form’s valid state based on all registered inputs -
fires any time a field is (de)registered.
Pass props to child elements during render
Pass props to child elements during render
Pass props to child elements during render
Simple Input Component
Putting Together All The Things
Thank You!
Slides: http://goo.gl/QI7p2a
Demo: http://goo.gl/xD8yQ4
Email: bradleyd60@gmail.com
Twitter: @dotNetKnight

More Related Content

Viewers also liked

KeyNote Connecting Up Conference
KeyNote Connecting Up ConferenceKeyNote Connecting Up Conference
KeyNote Connecting Up Conference
Beth Kanter
 
The dodo birds
The dodo birdsThe dodo birds
The dodo birds
barnha317
 
Louis Armstrong
Louis ArmstrongLouis Armstrong
Louis Armstrong
MrG
 
Bob Dylan: Voice of a generation
Bob Dylan: Voice of a generationBob Dylan: Voice of a generation
Bob Dylan: Voice of a generation
guimera
 

Viewers also liked (17)

Lionel Messi
Lionel MessiLionel Messi
Lionel Messi
 
Lionel messi
Lionel messiLionel messi
Lionel messi
 
Personal Development
Personal DevelopmentPersonal Development
Personal Development
 
Growth Hacking
Growth HackingGrowth Hacking
Growth Hacking
 
The Big Bang Theory
The Big Bang TheoryThe Big Bang Theory
The Big Bang Theory
 
NHS presentation
NHS presentationNHS presentation
NHS presentation
 
Digital analytics: Optimization (Lecture 10)
Digital analytics: Optimization (Lecture 10)Digital analytics: Optimization (Lecture 10)
Digital analytics: Optimization (Lecture 10)
 
KeyNote Connecting Up Conference
KeyNote Connecting Up ConferenceKeyNote Connecting Up Conference
KeyNote Connecting Up Conference
 
The dodo birds
The dodo birdsThe dodo birds
The dodo birds
 
Louis Armstrong
Louis ArmstrongLouis Armstrong
Louis Armstrong
 
Building Great Digital Marketing Teams
Building Great Digital Marketing TeamsBuilding Great Digital Marketing Teams
Building Great Digital Marketing Teams
 
Why Scala?
Why Scala?Why Scala?
Why Scala?
 
Bob Dylan: Voice of a generation
Bob Dylan: Voice of a generationBob Dylan: Voice of a generation
Bob Dylan: Voice of a generation
 
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBoosterDigital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
 
Google's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web AnalyticsGoogle's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web Analytics
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
 
Manchester city
Manchester cityManchester city
Manchester city
 

Similar to ReactJS Mixins

Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
helpido9
 
#42 green lantern framework
#42   green lantern framework#42   green lantern framework
#42 green lantern framework
Srilu Balla
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13
Niit Care
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Victor Rentea
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
 

Similar to ReactJS Mixins (20)

Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
 
#42 green lantern framework
#42   green lantern framework#42   green lantern framework
#42 green lantern framework
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014
 
DS Unit 6.ppt
DS Unit 6.pptDS Unit 6.ppt
DS Unit 6.ppt
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13
 
The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Custom fields in joomla
Custom fields in joomlaCustom fields in joomla
Custom fields in joomla
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
MobX: the way to simplicity
MobX: the way to simplicityMobX: the way to simplicity
MobX: the way to simplicity
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
 
Bringing classical OOP into JavaScript
Bringing classical OOP into JavaScriptBringing classical OOP into JavaScript
Bringing classical OOP into JavaScript
 
object oriented programming language.pptx
object oriented programming language.pptxobject oriented programming language.pptx
object oriented programming language.pptx
 
Boo Manifesto
Boo ManifestoBoo Manifesto
Boo Manifesto
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Intro To C++ - Class #19: Functions
Intro To C++ - Class #19: FunctionsIntro To C++ - Class #19: Functions
Intro To C++ - Class #19: Functions
 
Flash develop presentation
Flash develop presentationFlash develop presentation
Flash develop presentation
 
Engage - Expanding XPages with Bootstrap Plugins for ultimate usability
Engage - Expanding XPages with Bootstrap Plugins for ultimate usabilityEngage - Expanding XPages with Bootstrap Plugins for ultimate usability
Engage - Expanding XPages with Bootstrap Plugins for ultimate usability
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
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
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
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
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
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
 
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
 
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
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
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
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
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
 
%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
 

ReactJS Mixins

  • 1. The Public Parts Employer: Unicon, Inc Role: Sr. UI Developer Blog: blog.bradleygore.com Family: Carolina & Garrison About Me
  • 2.
  • 3. Mixin’ It Up With React Mixins -Bradley Gore
  • 4. The Problem HELP! I have potential for dynamically added/removed form-fields, but need for my form component to know whether or not it can submit. PS: Also must work in all browsers, be beautiful, easy to use, and done ASAP.
  • 5. Solution: Form Component where Inputs are “Registered” Submit Snap-in Form Text Input Field registerWithForm() Number Input Field deRegisterFromForm() Field Container
  • 6. What are React mixins? Mixins are a way for totally separate components to have common functionality...
  • 7. What are React mixins? Mixins are a way for totally separate components to have common functionality... ...and still remain totally separated even after the mixing is done.
  • 8.
  • 9.
  • 10.
  • 11. Form Component ● inputs ○ empty object placeholder for registered inputs to live ● registerInput(input) ○ takes the input being registered. Inputs are expected to have a name, as that’s the key in the inputs hash. ● deRegisterInput(name) ○ takes the de-registered input’s name, and deletes that key from this.inputs ● updateValidity() ○ sets the form’s valid state based on all registered inputs - fires any time a field is (de)registered.
  • 12. Pass props to child elements during render
  • 13. Pass props to child elements during render
  • 14. Pass props to child elements during render
  • 16. Putting Together All The Things
  • 17. Thank You! Slides: http://goo.gl/QI7p2a Demo: http://goo.gl/xD8yQ4 Email: bradleyd60@gmail.com Twitter: @dotNetKnight

Editor's Notes

  1. Even if I bomb out here tonight, I’ll still be loved - my son’s shirt says so.
  2. We want our various input fields to be able to all implement the same common interface in order to keep the form container updated on what’s going on, but we don’t want to have to repeat our code for each one. This is where mixins come into play!
  3. Only the truly common functionality is shared. This is much cleaner than just extending one object by another because you need 3% of the source object’s functionality!
  4. Mixin is just a plain ole javascript object. Within methods, “this” is automatically scoped to the component instance by React. These should be lean - only purely common functionality should go here.
  5. Mixin is just a plain ole javascript object. Within methods, “this” is automatically scoped to the component instance by React. These should be lean - only purely common functionality should go here.
  6. Mixin is just a plain ole javascript object. Within methods, “this” is automatically scoped to the component instance by React. These should be lean - only purely common functionality should go here.
  7. updateValidity - any time a new component is (de)registered, the form needs to re-evaluate its own validity
  8. render - React lifecycle event
  9. clonedChildren is essentially the input container - all inputs render here, but the form itself controls the submit button. Could easily add in some props and some logic to allow any consumer of the form component to control the submit button label, if there’s a cancel button, its label, etc….
  10. clonedChildren is essentially the input container - all inputs render here, but the form itself controls the submit button. Could easily add in some props and some logic to allow any consumer of the form component to control the submit button label, if there’s a cancel button, its label, etc….
  11. This is what will use our mixin. We have to build a component around a standard text input in order to make it part of our React-based environment. The beautiful thing is that we can see at one glance all of the separate items that “mix in” to this class. No guessing, no hunting for an $.extend call that references an instance of this class - it’s clearly defined in one place. 2 more lifecycle events.