Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
mobx-create-store
Advanced tools
This library is just a util on top of mobx.
$ npm install --save mobx mobx-react mobx-create-store
import React from "react"
import moment from "moment"
import { observer } from "mobx-react"
import { createStore } from "mobx-create-store"
const timer = createStore({
ticks: 0,
id: null,
toggle() {
if (!this.id) {
this.id = setInterval(() => this.ticks++, 10)
} else {
this.id = clearInterval(this.id)
}
},
get time() {
return moment(this.ticks * 10).format("mm:ss")
},
get fraction() {
return moment(this.ticks * 10).format("SS")
},
get label() {
return this.id ? "Stop" : "Start"
},
})
export default observer(() => (
<div>
<p>{timer.time}<small>{timer.fraction}</small></p>
<button onClick={timer.toggle}>{timer.label}</button>
</div>
))
Under the hood createStore
does the following:
All normal mobx gotchas apply.
FAQs
Mobx minimal API
The npm package mobx-create-store receives a total of 0 weekly downloads. As such, mobx-create-store popularity was classified as not popular.
We found that mobx-create-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.