Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@catastrophee/models

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@catastrophee/models

Mobx models for the web

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Getting started with Catatrophee Models

Install dependencies

npm install -s @catastrophee/models

or

yarn add @catastrophee/models

Catastrophee models have mobx as a dependency, mobx should be installed automatically when you install @catastrophee/models, but in case it doesn't, please install mobx.

npm install --save mobx

How to use it

You can use Catastrophee models in two different ways.

  1. With an already existing model or any other javascript code, including node when it is not browser dependant*
  2. On your component

*Browser dependant models can attach event listeners or need the window object, when you are using node, most likely those are not going to be available

With existing model

Simply import the model of your choice and use it as you would any other model.

On your components

Make your component observable

In order for your component to render with the lastet synchronized changes, it needs to be active listening when data changes on your model. In order for that to happen you need to wrap your component in an observer. The observer helper is available from 'mobx-react' (note: not mobx)

Install mobx-react

npm install --save mobx-react

On your component, import mobx-react and wrap the component on a observer

For class based components

import { observer } from 'mobx-react';

@observer
export class MyComponent extends React.Component {
  ...
}

For functional components

import { observer } from 'mobx-react';

export const MyComponent = observer(({ props }) => {
  ...
})

FAQs

Package last updated on 13 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc