Gathering detailed insights and metrics for mobx
Gathering detailed insights and metrics for mobx
Gathering detailed insights and metrics for mobx
Gathering detailed insights and metrics for mobx
npm install mobx
eslint-plugin-mobx@0.0.13
Published on 21 Oct 2024
eslint-plugin-mobx@0.0.12
Published on 20 Oct 2024
mobx@6.13.5
Published on 16 Oct 2024
mobx@6.13.4
Published on 15 Oct 2024
mobx@6.13.3
Published on 26 Sept 2024
mobx@6.13.2
Published on 07 Sept 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
27,593 Stars
3,316 Commits
1,775 Forks
342 Watching
31 Branches
338 Contributors
Updated on 28 Nov 2024
TypeScript (54.7%)
JavaScript (42.95%)
HTML (2.05%)
CSS (0.3%)
Cumulative downloads
Total Downloads
Last day
-6.1%
325,661
Compared to previous day
Last week
4.7%
1,777,510
Compared to previous week
Last month
12.5%
7,552,174
Compared to previous month
Last year
34.7%
72,046,442
Compared to previous year
Simple, scalable state management.
Documentation can be found at mobx.js.org.
MobX is made possible by the generosity of the sponsors below, and many other individual backers. Sponsoring directly impacts the longevity of this project.
🥇🥇 Platinum sponsors ($5000+ total contribution): 🥇🥇
🥇 Gold sponsors ($2500+ total contribution):
🥈 Silver sponsors ($500+ total contributions):
Anything that can be derived from the application state, should be. Automatically.
MobX is a signal based, battle-tested library that makes state management simple and scalable by transparently applying functional reactive programming. The philosophy behind MobX is simple:
Write minimalistic, boilerplate-free code that captures your intent. Trying to update a record field? Simply use a normal JavaScript assignment — the reactivity system will detect all your changes and propagate them out to where they are being used. No special tools are required when updating data in an asynchronous process.
All changes to and uses of your data are tracked at runtime, building a dependency tree that captures all relations between state and output. This guarantees that computations that depend on your state, like React components, run only when strictly needed. There is no need to manually optimize components with error-prone and sub-optimal techniques like memoization and selectors.
MobX is unopinionated and allows you to manage your application state outside of any UI framework. This makes your code decoupled, portable, and above all, easily testable.
So what does code that uses MobX look like?
1import React from "react" 2import ReactDOM from "react-dom" 3import { makeAutoObservable } from "mobx" 4import { observer } from "mobx-react-lite" 5 6// Model the application state. 7function createTimer() { 8 return makeAutoObservable({ 9 secondsPassed: 0, 10 increase() { 11 this.secondsPassed += 1 12 }, 13 reset() { 14 this.secondsPassed = 0 15 } 16 }) 17} 18 19const myTimer = createTimer() 20 21// Build a "user interface" that uses the observable state. 22const TimerView = observer(({ timer }) => ( 23 <button onClick={() => timer.reset()}>Seconds passed: {timer.secondsPassed}</button> 24)) 25 26ReactDOM.render(<TimerView timer={myTimer} />, document.body) 27 28// Update the 'Seconds passed: X' text every second. 29setInterval(() => { 30 myTimer.increase() 31}, 1000)
The observer
wrapper around the TimerView
React component will automatically detect that rendering
depends on the timer.secondsPassed
observable, even though this relationship is not explicitly defined. The reactivity system will take care of re-rendering the component when precisely that field is updated in the future.
Every event (onClick
/ setInterval
) invokes an action (myTimer.increase
/ myTimer.reset
) that updates observable state (myTimer.secondsPassed
).
Changes in the observable state are propagated precisely to all computations and side effects (TimerView
) that depend on the changes being made.
This conceptual picture can be applied to the above example, or any other application using MobX.
To learn about the core concepts of MobX using a larger example, check out The gist of MobX page, or take the 10 minute interactive introduction to MobX and React. The philosophy and benefits of the mental model provided by MobX are also described in great detail in the blog posts UI as an afterthought and How to decouple state and UI (a.k.a. you don’t need componentWillMount).
The MobX Quick Start Guide ($24.99) by Pavan Podila and Michel Weststrate is available as an ebook, paperback, and on the O'Reilly platform (see preview).
MobX is inspired by reactive programming principles, which are for example used in spreadsheets. It is inspired by model–view–viewmodel frameworks like MeteorJS's Tracker, Knockout and Vue.js, but MobX brings transparent functional reactive programming (TFRP, a concept which is further explained in the MobX book) to the next level and provides a standalone implementation. It implements TFRP in a glitch-free, synchronous, predictable and efficient manner.
A ton of credit goes to Mendix, for providing the flexibility and support to maintain MobX and the chance to prove the philosophy of MobX in a real, complex, performance critical applications.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
22 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 13/18 approved changesets -- score normalized to 7
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
96 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More