SlideShare a Scribd company logo
1 of 19
Download to read offline
Mobx
Lucas Lira Gomes <@x8lucas8x>
Software Engineer
Passionate Hacker
ArchLinux Zealot
FOSS Enthusiast
I’m fond of doing
things that last
and all that jazz.
Lucas Lira Gomes
2
contact@x8lucas8x.com
linkedin.com/in/x8lucas8x
facebook.com/x8lucas8x
youtube.com/X80lucas08X
twitter.com/x8lucas8x
x8lucas8x.com
github.com/x8lucas8x
Mobx
● Simple, scalable state management
Concepts
API Overview
● @observable
● @computed
● @action
● reaction
● @observer
@observable
import { observable } from "mobx";
class OrderLine {
@observable price = 0;
@observable amount = 1;
}
const orderLineStore = new OrderLine();
export default orderLineStore;
@computed
import { observable, computed } from "mobx";
class OrderLine {
@observable price = 0;
@observable amount = 1;
@computed get total() {
return this.price * this.amount;
}
}
const orderLineStore = new OrderLine();
export default orderLineStore;
@action
import { observable, action } from "mobx";
class OrderLine {
@observable price = 0;
@observable amount = 1;
@action getPrice() {
fetch(
"www.orderline.com/api/price"
).then(this.getPriceReceive);
}
@action getPriceReceive(response) {
this.price = response.json().price;
}
}
...
reaction
import {reaction, autorun, when} from "mobx";
const reaction1 = reaction(
() => orderLine.total,
total => console.log("reaction 1:", total)
);
const autorun1 = autorun(
() => console.log(
"autorun 1:", orderLine.total
)
);
const when1 = when(
() => orderLine.total > 1,
() => console.log("when 1: true")
);
@observer
import { observer } from "mobx-react";
@observer
class Total extends React.Component {
render() {
const { orderLineStore } = this.props;
return (
<span>
{orderLineStore.total}
</span>
);
}
};
What it reacts to?
Pros x Cons
● Pros
○ Open Source
○ Familiar
○ Less code
○ No thunks and ...
○ Interoperability
○ Active community
● Cons
○ DevTools
○ Tracking access
implications
Good Practices
Store Injection
import { Provider } from "mobx-react";
…
ReactDOM.render(
...
<Provider stores={allStores}>
<App />
</Provider>
...,
document.getElementById('root')
);
import { observer, inject } from "mobx-react";
@inject("stores")
@observer
class ContactFormPage extends Component {
…
// accessing store via props
const { contactStore } = this.props.stores;
return (
<ContactForm
store={contactStore}
form={this.form}
contact={contactStore.entity}
/>
)
…
}
Root Store
import { observer } from "mobx-react";
class RootStore {
constructor() {
this.userStore = new UserStore(this);
}
}
class TodoStore {
@observable todos = []
constructor(rootStore) {
this.rootStore = rootStore;
}
}
...
Strict mode
mobx.useStrict(true) // don't allow state modifications outside actions
Mobx DEV Tools
import DevTools from "mobx-react-devtools";
class MyApp extends React.Component {
render() {
return (
<div>
...
<DevTools />
</div>
);
}
}
References
1. https://mobx.js.org/
18
Mobx
Lucas Lira Gomes <@x8lucas8x>

More Related Content

What's hot

Reasons to use React Query
Reasons to use React QueryReasons to use React Query
Reasons to use React Queryjavaria javaid
 
Accelerate Development with NX Build System
Accelerate Development with NX Build SystemAccelerate Development with NX Build System
Accelerate Development with NX Build SystemThien Ly
 
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~日本マイクロソフト株式会社
 
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...GreeceJS
 
そのRails Engine、 本当に必要ですか?
そのRails Engine、 本当に必要ですか?そのRails Engine、 本当に必要ですか?
そのRails Engine、 本当に必要ですか?nixiesan
 
20160406 ROS 1차 강의 (for 아스라다 팀)
20160406 ROS 1차 강의 (for 아스라다 팀)20160406 ROS 1차 강의 (for 아스라다 팀)
20160406 ROS 1차 강의 (for 아스라다 팀)Yoonseok Pyo
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningMongoDB
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia NecheporenkoOdessaJS Conf
 
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説Fumiya Sakai
 
そんなトランザクションマネージャで大丈夫か?
そんなトランザクションマネージャで大丈夫か?そんなトランザクションマネージャで大丈夫か?
そんなトランザクションマネージャで大丈夫か?takezoe
 
PHPからgoへの移行で分かったこと
PHPからgoへの移行で分かったことPHPからgoへの移行で分かったこと
PHPからgoへの移行で分かったことgree_tech
 
知っておきたいFirebase の色んな上限について
知っておきたいFirebase の色んな上限について知っておきたいFirebase の色んな上限について
知っておきたいFirebase の色んな上限について健一 辰濱
 
Mobile application development React Native - Tidepool Labs
Mobile application development React Native - Tidepool LabsMobile application development React Native - Tidepool Labs
Mobile application development React Native - Tidepool LabsHarutyun Abgaryan
 
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~JavaScriptの仕組みと未来のJavaScript ~ESNextとは~
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~Yuki Hirano
 
OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料Tsuyoshi Kawarasaki
 

What's hot (20)

Reasons to use React Query
Reasons to use React QueryReasons to use React Query
Reasons to use React Query
 
Accelerate Development with NX Build System
Accelerate Development with NX Build SystemAccelerate Development with NX Build System
Accelerate Development with NX Build System
 
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~
【de:code 2020】 React Native で Windows アプリ開発 ~React Native for Windows~
 
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
そのRails Engine、 本当に必要ですか?
そのRails Engine、 本当に必要ですか?そのRails Engine、 本当に必要ですか?
そのRails Engine、 本当に必要ですか?
 
20160406 ROS 1차 강의 (for 아스라다 팀)
20160406 ROS 1차 강의 (for 아스라다 팀)20160406 ROS 1차 강의 (for 아스라다 팀)
20160406 ROS 1차 강의 (for 아스라다 팀)
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
 
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説
動画プレイヤーアプリの開発を通じて学んだ機能を実現するための要点解説
 
そんなトランザクションマネージャで大丈夫か?
そんなトランザクションマネージャで大丈夫か?そんなトランザクションマネージャで大丈夫か?
そんなトランザクションマネージャで大丈夫か?
 
PHPからgoへの移行で分かったこと
PHPからgoへの移行で分かったことPHPからgoへの移行で分かったこと
PHPからgoへの移行で分かったこと
 
知っておきたいFirebase の色んな上限について
知っておきたいFirebase の色んな上限について知っておきたいFirebase の色んな上限について
知っておきたいFirebase の色んな上限について
 
Mobile application development React Native - Tidepool Labs
Mobile application development React Native - Tidepool LabsMobile application development React Native - Tidepool Labs
Mobile application development React Native - Tidepool Labs
 
Angular
AngularAngular
Angular
 
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~JavaScriptの仕組みと未来のJavaScript ~ESNextとは~
JavaScriptの仕組みと未来のJavaScript ~ESNextとは~
 
Single Page Applications
Single Page ApplicationsSingle Page Applications
Single Page Applications
 
OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料
 
Firebase
Firebase Firebase
Firebase
 

More from Lucas Lira Gomes

More from Lucas Lira Gomes (7)

Jest
JestJest
Jest
 
Context API in React
Context API in ReactContext API in React
Context API in React
 
How Not To GIT
How Not To GITHow Not To GIT
How Not To GIT
 
Search in Django
Search in DjangoSearch in Django
Search in Django
 
Kanban
KanbanKanban
Kanban
 
How To Open Source
How To Open SourceHow To Open Source
How To Open Source
 
Experiências de contribuição com o KDE/Amarok
Experiências de contribuição com o KDE/AmarokExperiências de contribuição com o KDE/Amarok
Experiências de contribuição com o KDE/Amarok
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Mobx

  • 1. Mobx Lucas Lira Gomes <@x8lucas8x>
  • 2. Software Engineer Passionate Hacker ArchLinux Zealot FOSS Enthusiast I’m fond of doing things that last and all that jazz. Lucas Lira Gomes 2 contact@x8lucas8x.com linkedin.com/in/x8lucas8x facebook.com/x8lucas8x youtube.com/X80lucas08X twitter.com/x8lucas8x x8lucas8x.com github.com/x8lucas8x
  • 3. Mobx ● Simple, scalable state management
  • 5. API Overview ● @observable ● @computed ● @action ● reaction ● @observer
  • 6. @observable import { observable } from "mobx"; class OrderLine { @observable price = 0; @observable amount = 1; } const orderLineStore = new OrderLine(); export default orderLineStore;
  • 7. @computed import { observable, computed } from "mobx"; class OrderLine { @observable price = 0; @observable amount = 1; @computed get total() { return this.price * this.amount; } } const orderLineStore = new OrderLine(); export default orderLineStore;
  • 8. @action import { observable, action } from "mobx"; class OrderLine { @observable price = 0; @observable amount = 1; @action getPrice() { fetch( "www.orderline.com/api/price" ).then(this.getPriceReceive); } @action getPriceReceive(response) { this.price = response.json().price; } } ...
  • 9. reaction import {reaction, autorun, when} from "mobx"; const reaction1 = reaction( () => orderLine.total, total => console.log("reaction 1:", total) ); const autorun1 = autorun( () => console.log( "autorun 1:", orderLine.total ) ); const when1 = when( () => orderLine.total > 1, () => console.log("when 1: true") );
  • 10. @observer import { observer } from "mobx-react"; @observer class Total extends React.Component { render() { const { orderLineStore } = this.props; return ( <span> {orderLineStore.total} </span> ); } };
  • 12. Pros x Cons ● Pros ○ Open Source ○ Familiar ○ Less code ○ No thunks and ... ○ Interoperability ○ Active community ● Cons ○ DevTools ○ Tracking access implications
  • 14. Store Injection import { Provider } from "mobx-react"; … ReactDOM.render( ... <Provider stores={allStores}> <App /> </Provider> ..., document.getElementById('root') ); import { observer, inject } from "mobx-react"; @inject("stores") @observer class ContactFormPage extends Component { … // accessing store via props const { contactStore } = this.props.stores; return ( <ContactForm store={contactStore} form={this.form} contact={contactStore.entity} /> ) … }
  • 15. Root Store import { observer } from "mobx-react"; class RootStore { constructor() { this.userStore = new UserStore(this); } } class TodoStore { @observable todos = [] constructor(rootStore) { this.rootStore = rootStore; } } ...
  • 16. Strict mode mobx.useStrict(true) // don't allow state modifications outside actions
  • 17. Mobx DEV Tools import DevTools from "mobx-react-devtools"; class MyApp extends React.Component { render() { return ( <div> ... <DevTools /> </div> ); } }
  • 19. Mobx Lucas Lira Gomes <@x8lucas8x>