foxhound87
5/7/2016 - 9:28 PM

State Management & Hydration with MobX [Ep. 05] /src/components/home.js

State Management & Hydration with MobX [Ep. 05] /src/components/home.js

import React, { Component } from 'react';
import { observer } from 'mobx-react';

@observer(['store'])
export default class Posts extends Component {

  static fetchData({ store }) {
    // populate 'list' property of 'PostStore'
    return store.post.find();
  }

  static propTypes = {
    store: React.PropTypes.object,
  };

  render() {
    // retrieve post list data
    const posts = this.props.store.post.list;
    
    return (
     ...
    );
  }
}