How to use the react-komposer.composeWithTracker function in react-komposer

To help you get started, we’ve selected a few react-komposer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topogram / topogram / imports / ui / components / topograms / TopogramPrivateList.jsx View on Github external
import { composeWithTracker } from 'react-komposer'
import TopogramList from './TopogramList.jsx'
import { Topograms } from '../../../api/collections.js'
import { Meteor } from 'meteor/meteor'

function composer(props, onData) {
  const handle = Meteor.subscribe('topograms.private')
  if (handle.ready()) {
    const topograms = Topograms.find({ }, { 'sort': {  'createdAt': -1 } }).fetch()
    onData(null, { topograms }) // args: err, topograms, editable
  }
}

export default composeWithTracker(composer)(TopogramList)
github topogram / topogram / imports / ui / components / topograms / TopogramPublicList.jsx View on Github external
import { composeWithTracker } from 'react-komposer'
import TopogramList from './TopogramList.jsx'
import { Topograms } from '../../../api/collections.js'

function composer(props, onData) {
  const handle = Meteor.subscribe('topograms.public')
  if (handle.ready()) {
    const topograms = Topograms.find({ 'sharedPublic': true }, { 'sort': {  'createdAt': 1 } }).fetch()
    console.log(topograms)
    onData(null, { topograms })
  }
}


export default composeWithTracker(composer)(TopogramList)
github meteor / todos / imports / ui / helpers / create-container-with-komposer.js View on Github external
if (typeof options === 'function') {
    expandedOptions = {
      getMeteorData: options,
    };
  }

  const {
    getMeteorData,
    loadingComponent = null,
    errorComponent = null,
    pure = true,
  } = expandedOptions;

  const compose = (props, onData) => onData(null, getMeteorData(props));

  return composeWithTracker(
    compose,
    loadingComponent,
    errorComponent,
    { pure }
  )(Component);
}
github meteor / module-todos-react / imports / ui / helpers / create-container-with-komposer.js View on Github external
if (typeof options === 'function') {
    options = {
      getMeteorData: options
    }
  }

  const {
    getMeteorData,
    loadingComponent = null,
    errorComponent = null,
    pure = true
  } = options;

  const compose = (props, onData) => onData(null, getMeteorData(props));

  return composeWithTracker(
    compose,
    loadingComponent,
    errorComponent,
    { pure }
  )(Component);
}
github themeteorchef / base / imports / ui / containers / app-navigation.js View on Github external
import { composeWithTracker } from 'react-komposer';
import { Meteor } from 'meteor/meteor';
import { AppNavigation } from '../components/app-navigation';

const composer = (props, onData) => {
  onData(null, { hasUser: Meteor.user() });
};

export default composeWithTracker(composer, {}, {}, { pure: false })(AppNavigation);
github themeteorchef / base / imports / ui / containers / DocumentsList.js View on Github external
import { composeWithTracker } from 'react-komposer';
import { Meteor } from 'meteor/meteor';
import Documents from '../../api/documents/documents.js';
import DocumentsList from '../components/DocumentsList.js';
import Loading from '../components/Loading.js';

const composer = (params, onData) => {
  const subscription = Meteor.subscribe('documents.list');
  if (subscription.ready()) {
    const documents = Documents.find().fetch();
    onData(null, { documents });
  }
};

export default composeWithTracker(composer, Loading)(DocumentsList);
github kadira-samples / meteor-data-and-react / app / containers / post_list.js View on Github external
import {composeWithTracker} from 'react-komposer';
import PostList from '../components/post_list.jsx';
import { DocHead } from 'meteor/kadira:dochead';

function composer(props, onData) {
  const handle = Meteor.subscribe('posts');
  if(handle.ready()) {
    const posts = Posts.find({}, {sort: {_id: 1}}).fetch();
    onData(null, {posts});
  };

  DocHead.setTitle('My Blog');
};

export default composeWithTracker(composer)(PostList);
github LessWrong2 / Lesswrong2 / packages / nova-core / lib / containers / AppComposer.jsx View on Github external
const data = {
    currentUser: Meteor.user(),
    actions: {call: Meteor.call},
    events: Events,
    messages: Messages
  }

  if (!subscriptions.length || _.every(subscriptions, handle => handle.ready())) {
    data.ready = true;
    onData(null, data);
  } else {
    onData(null, {ready: false});
  }
}

module.exports = composeWithTracker(composer);
export default composeWithTracker(composer);

react-komposer

Generic way to compose data containers for React.

MIT
Latest version published 8 years ago

Package Health Score

53 / 100
Full package analysis