SlideShare a Scribd company logo
1 of 30
Download to read offline
REACT
INTRODUCTION TO WITH
MOBX!
ABOUT AMBROSE
▸ Glad dad of 6 munchkins.
▸ Making pro software for ~18 years 

Computer geek since 1987
▸ Shipped over 45 projects, led over 20. 2 Patents. 

Sometime dev, arch, UX guy, manager, PM, etc.
▸ 8x Microsoft MVP; Books, Blogs…
▸ Gone Skinning Dipping in Bulgarian Mountain Hot Springs
INTRO TO REACT WITH MOBX
THE PLAN
▸ Why MobX?

In Which I Cover the Complete History of Functional State Management (j/k)
▸ Key Concepts

A Bit Mind-bending but Easy to Use
▸ With the Showing of Some Examples

Someone just told me these are the BEST examples!
INTRO TO REACT WITH MOBX
ABOUT YOU?
▸ Front End or Full Stack Dev
▸ Comfy with JavaScript,
ideally ES2015+.
▸ You went to my last session
or already are familiar with
React.
▸ You are not a MobX expert.
INTRO TO REACT WITH MOBX
WHY MOBX?
▸ It Just Feels Right
▸ Easy to Use*
▸ Less Trouble than setState
▸ Simpler/Less Dogmatic

then Redux
▸ Widely Used

https://github.com/mobxjs/awesome-mobx
INTRO TO REACT WITH MOBX
PREFACE: GETTING MOBX
▸ https://reactjs.org/ <- First Get React
▸ https://mobx.js.org/ - Then Get MobX



npm i mobx mobx-react —save
“UNIDIRECTIONAL DATA FLOW”
KEY CONCEPT #1
INTRO TO REACT WITH MOBX
COMPONENT COMMUNICATION
PROPS DOWN
EVENTS UP
INTRO TO REACT WITH MOBX
MOBX
PROPS DOWN
EVENTS UP
STATE ACTIONS
OBSERVABLE
KEY CONCEPT #2
INTRO TO REACT WITH MOBX
JUST ADD WATER!
▸ Add MobX to your project.
▸ Start decorating!
DECORATORS
KEY CONCEPT #2.5
INTRO TO REACT WITH MOBX
DECORATE YOUR CLASSES (FUNCTIONS) AND PROPERTIES
▸ Declarative way to augment your code. (Similar to .NET
Attributes)
▸ Syntax*: prefix thing:

@[decorator][(options)] [thing]
▸ Very common for MobX:
▸ @observable myProp;
▸ @observer class MyComponent {}
*Syntax is subject to change as this is a Stage 2 proposal.
INTRO TO REACT WITH MOBX
NB: USING DECORATORS WITH VS CODE
▸ Unless you like this:
▸ Add a tsconfig.json to your project root like this:
INTRO TO REACT WITH MOBX
BACK TO JUST ADDING WATER!
▸ Add MobX to your project.
▸ Start decorating!
DON’T FORGET ABOUT
@COMPUTED!
Ambrose
INTRO TO REACT WITH MOBX
INTRO TO REACT WITH MOBX
CAUTION: MOBX AND CREATE-REACT-APP
▸ CRA - Does not allow build config. Does not allow decorators (Stage 2).
▸ Option: Use without decorators

https://github.com/benawad/simple-mobx/tree/1_counter
▸ Option: Use npm run eject

https://swizec.com/blog/mobx-with-create-react-app/swizec/7158
▸ Option: Use custom-react-scripts

https://medium.com/@kitze/configure-create-react-app-without-ejecting-
d8450e96196a
▸ More on with/without decorators: https://mobx.js.org/best/decorators.html
INTRO TO REACT WITH MOBX
CONVERTING CREATE-REACT-APP
▸ yarn remove react-scripts && yarn add
custom-react-scripts
▸ Add .env file with REACT_APP_DECORATORS = true;
▸ npm i mobx mobx-react —save
OBSERVER
KEY CONCEPT #3
MODIFY THROUGH “ACTIONS”
KEY CONCEPT #4
THE “STORE”
KEY CONCEPT #5
STOOOOOOOORE…
https://mobx.js.org/best/store.html
OTHER “DERIVATIONS” AND GOODIES
KEY CONCEPT #6
More at: https://mobx.js.org/intro/concepts.html
INTRO TO REACT WITH MOBX
COMPUTED
ONE OF MY
OBSERVABLES
CHANGED
HEY, I PROBABLY
HAVE A NEW VALUE!
INTRO TO REACT WITH MOBX
REACTION
ONE OF MY
OBSERVABLES
CHANGED
Secret Agent Man
INTRO TO REACT WITH MOBX
OTHER GOODIES
https://mobx.js.org/refguide/api.html
Scroll down to Utilities
isArrayLike!
THERE BE DRAGONS
WARNING:
INTRO TO REACT WITH MOBX
THAT’S IT! YOU’VE SEEN…
▸ What MobX is All About
▸ Unidirectional Data Flow
▸ Decorators:
▸ @observable
▸ @observer
▸ @computed
▸ How to Get More Reactive
▸ Modifying State with
Actions
▸ Fancypants “Stores”
▸ Other Goodies
REPETITIO MATER STUDIORUM
EST.
Ancient Dude
INTRO TO REACT WITH MOBX
REPETITION IS THE MOTHER OF
ALL LEARNING.
Dude What Speaks Modern English
INTRO TO REACT WITH MOBX
Introduction to React with MobX

More Related Content

What's hot

Microcopy | An Easy to Use Guide
Microcopy | An Easy to Use Guide Microcopy | An Easy to Use Guide
Microcopy | An Easy to Use Guide Amol Chandwadkar
 
Overcoming Command Line Allergies
Overcoming Command Line AllergiesOvercoming Command Line Allergies
Overcoming Command Line AllergiesElaine Nelson
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAnkur Srivastava
 
Have we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpHave we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpBedis ElAchèche
 
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management [PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management CheyenneWalls1
 
08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Presorajivmordani
 

What's hot (10)

October 2014 UG Session Promo Slide Deck
October 2014 UG Session Promo Slide DeckOctober 2014 UG Session Promo Slide Deck
October 2014 UG Session Promo Slide Deck
 
Microcopy | An Easy to Use Guide
Microcopy | An Easy to Use Guide Microcopy | An Easy to Use Guide
Microcopy | An Easy to Use Guide
 
GNU Screen
GNU ScreenGNU Screen
GNU Screen
 
Overcoming Command Line Allergies
Overcoming Command Line AllergiesOvercoming Command Line Allergies
Overcoming Command Line Allergies
 
Flashmeeting / Chris Barker
Flashmeeting / Chris BarkerFlashmeeting / Chris Barker
Flashmeeting / Chris Barker
 
Magit
MagitMagit
Magit
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Have we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpHave we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUp
 
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management [PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management
[PDF] How to Become a Scrum Master in 7 Simple Steps Agile Project Management
 
08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso
 

Similar to Introduction to React with MobX

BSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueBSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueAndrew Freeborn
 
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP ModeEmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP ModeMatt Ray
 
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...VictorSzoltysek
 
State Machines and Workflow Nets on your PHP projects
State Machines and Workflow Nets on your PHP projectsState Machines and Workflow Nets on your PHP projects
State Machines and Workflow Nets on your PHP projectsDaniel Abad Cambronero
 
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLICode on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLIBrian McKeiver
 
Apache Mesos Distributed Computing Talk
Apache Mesos Distributed Computing Talk Apache Mesos Distributed Computing Talk
Apache Mesos Distributed Computing Talk brandongulla
 
2017-10-24 All Day DevOps - Disposable Development Environments
2017-10-24 All Day DevOps - Disposable Development Environments2017-10-24 All Day DevOps - Disposable Development Environments
2017-10-24 All Day DevOps - Disposable Development EnvironmentsBoyd Hemphill
 
Fullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFrances Coronel
 
A Git MVP Workflow
A Git MVP WorkflowA Git MVP Workflow
A Git MVP WorkflowBurt Lum
 
Continuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build ServerContinuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build ServerAdam Paxton
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageAndrii Lundiak
 
Introduction to Jenkins X
Introduction to Jenkins XIntroduction to Jenkins X
Introduction to Jenkins XFaithlin Paul
 
Dev-Jam 2019 - Developing & Contributing to OpenNMS
Dev-Jam 2019 - Developing & Contributing to OpenNMSDev-Jam 2019 - Developing & Contributing to OpenNMS
Dev-Jam 2019 - Developing & Contributing to OpenNMSRonny Trommer
 
Let's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAMLet's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAMAmoniac OÜ
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for BeginnersSean Prunka
 
Serverless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsServerless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsJoseph Lust
 
Mocha, chai and sinon
Mocha, chai and sinonMocha, chai and sinon
Mocha, chai and sinonAndrew Dixon
 

Similar to Introduction to React with MobX (20)

BSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueBSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs Blue
 
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP ModeEmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode
EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode
 
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
 
State Machines and Workflow Nets on your PHP projects
State Machines and Workflow Nets on your PHP projectsState Machines and Workflow Nets on your PHP projects
State Machines and Workflow Nets on your PHP projects
 
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLICode on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
 
Apache Mesos Distributed Computing Talk
Apache Mesos Distributed Computing Talk Apache Mesos Distributed Computing Talk
Apache Mesos Distributed Computing Talk
 
2017-10-24 All Day DevOps - Disposable Development Environments
2017-10-24 All Day DevOps - Disposable Development Environments2017-10-24 All Day DevOps - Disposable Development Environments
2017-10-24 All Day DevOps - Disposable Development Environments
 
Fullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & Tricks
 
A Git MVP Workflow
A Git MVP WorkflowA Git MVP Workflow
A Git MVP Workflow
 
Continuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build ServerContinuous Cross Platform Mobile App Development using Jenkins Build Server
Continuous Cross Platform Mobile App Development using Jenkins Build Server
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
 
Introduction to Jenkins X
Introduction to Jenkins XIntroduction to Jenkins X
Introduction to Jenkins X
 
Intro to react_v2
Intro to react_v2Intro to react_v2
Intro to react_v2
 
Dev-Jam 2019 - Developing & Contributing to OpenNMS
Dev-Jam 2019 - Developing & Contributing to OpenNMSDev-Jam 2019 - Developing & Contributing to OpenNMS
Dev-Jam 2019 - Developing & Contributing to OpenNMS
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Let's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAMLet's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAM
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for Beginners
 
Zenoss: Buildout
Zenoss: BuildoutZenoss: Buildout
Zenoss: Buildout
 
Serverless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsServerless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOps
 
Mocha, chai and sinon
Mocha, chai and sinonMocha, chai and sinon
Mocha, chai and sinon
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Introduction to React with MobX

  • 2. ABOUT AMBROSE ▸ Glad dad of 6 munchkins. ▸ Making pro software for ~18 years 
 Computer geek since 1987 ▸ Shipped over 45 projects, led over 20. 2 Patents. 
 Sometime dev, arch, UX guy, manager, PM, etc. ▸ 8x Microsoft MVP; Books, Blogs… ▸ Gone Skinning Dipping in Bulgarian Mountain Hot Springs
  • 3. INTRO TO REACT WITH MOBX THE PLAN ▸ Why MobX?
 In Which I Cover the Complete History of Functional State Management (j/k) ▸ Key Concepts
 A Bit Mind-bending but Easy to Use ▸ With the Showing of Some Examples
 Someone just told me these are the BEST examples!
  • 4. INTRO TO REACT WITH MOBX ABOUT YOU? ▸ Front End or Full Stack Dev ▸ Comfy with JavaScript, ideally ES2015+. ▸ You went to my last session or already are familiar with React. ▸ You are not a MobX expert.
  • 5. INTRO TO REACT WITH MOBX WHY MOBX? ▸ It Just Feels Right ▸ Easy to Use* ▸ Less Trouble than setState ▸ Simpler/Less Dogmatic
 then Redux ▸ Widely Used
 https://github.com/mobxjs/awesome-mobx
  • 6. INTRO TO REACT WITH MOBX PREFACE: GETTING MOBX ▸ https://reactjs.org/ <- First Get React ▸ https://mobx.js.org/ - Then Get MobX
 
 npm i mobx mobx-react —save
  • 8. INTRO TO REACT WITH MOBX COMPONENT COMMUNICATION PROPS DOWN EVENTS UP
  • 9. INTRO TO REACT WITH MOBX MOBX PROPS DOWN EVENTS UP STATE ACTIONS
  • 11. INTRO TO REACT WITH MOBX JUST ADD WATER! ▸ Add MobX to your project. ▸ Start decorating!
  • 13. INTRO TO REACT WITH MOBX DECORATE YOUR CLASSES (FUNCTIONS) AND PROPERTIES ▸ Declarative way to augment your code. (Similar to .NET Attributes) ▸ Syntax*: prefix thing:
 @[decorator][(options)] [thing] ▸ Very common for MobX: ▸ @observable myProp; ▸ @observer class MyComponent {} *Syntax is subject to change as this is a Stage 2 proposal.
  • 14. INTRO TO REACT WITH MOBX NB: USING DECORATORS WITH VS CODE ▸ Unless you like this: ▸ Add a tsconfig.json to your project root like this:
  • 15. INTRO TO REACT WITH MOBX BACK TO JUST ADDING WATER! ▸ Add MobX to your project. ▸ Start decorating!
  • 17. INTRO TO REACT WITH MOBX CAUTION: MOBX AND CREATE-REACT-APP ▸ CRA - Does not allow build config. Does not allow decorators (Stage 2). ▸ Option: Use without decorators
 https://github.com/benawad/simple-mobx/tree/1_counter ▸ Option: Use npm run eject
 https://swizec.com/blog/mobx-with-create-react-app/swizec/7158 ▸ Option: Use custom-react-scripts
 https://medium.com/@kitze/configure-create-react-app-without-ejecting- d8450e96196a ▸ More on with/without decorators: https://mobx.js.org/best/decorators.html
  • 18. INTRO TO REACT WITH MOBX CONVERTING CREATE-REACT-APP ▸ yarn remove react-scripts && yarn add custom-react-scripts ▸ Add .env file with REACT_APP_DECORATORS = true; ▸ npm i mobx mobx-react —save
  • 21. THE “STORE” KEY CONCEPT #5 STOOOOOOOORE… https://mobx.js.org/best/store.html
  • 22. OTHER “DERIVATIONS” AND GOODIES KEY CONCEPT #6 More at: https://mobx.js.org/intro/concepts.html
  • 23. INTRO TO REACT WITH MOBX COMPUTED ONE OF MY OBSERVABLES CHANGED HEY, I PROBABLY HAVE A NEW VALUE!
  • 24. INTRO TO REACT WITH MOBX REACTION ONE OF MY OBSERVABLES CHANGED Secret Agent Man
  • 25. INTRO TO REACT WITH MOBX OTHER GOODIES https://mobx.js.org/refguide/api.html Scroll down to Utilities isArrayLike!
  • 27. INTRO TO REACT WITH MOBX THAT’S IT! YOU’VE SEEN… ▸ What MobX is All About ▸ Unidirectional Data Flow ▸ Decorators: ▸ @observable ▸ @observer ▸ @computed ▸ How to Get More Reactive ▸ Modifying State with Actions ▸ Fancypants “Stores” ▸ Other Goodies
  • 28. REPETITIO MATER STUDIORUM EST. Ancient Dude INTRO TO REACT WITH MOBX
  • 29. REPETITION IS THE MOTHER OF ALL LEARNING. Dude What Speaks Modern English INTRO TO REACT WITH MOBX