Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 519 Bytes

File metadata and controls

38 lines (26 loc) · 519 Bytes

MobX

Observable

Setup

npm install mobx mobx-react --save-dev

Observable / Observer

Model (Stream)

import { observable } from 'mobx';

const list = observable([]);
<View list={list} />;

Update (Publish)

setTimeout(() => {
  list.push({});
}, 10000);

View (Subscribe)

import { observer } from 'mobx-react';
export function View() {}
export default observer(View);