How to use react-komposer - 10 common examples

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 inProgress-team / react-native-meteor / src / components / composeWithTracker.js View on Github external
return Trackr.autorun(() => {
        _meteorDataDep.depend();
        trackerCleanup = reactiveFn(props, onData);
      });
    });

    return () => {
      if (typeof trackerCleanup === 'function') {
        trackerCleanup();
      }
      Data.offChange(_meteorDataChangedCallback);
      return handler.stop();
    };
  };

  return compose(onPropsChange, L, E, options);
}
github erxes / erxes / imports / react-ui / layout / containers / MainLayout.js View on Github external
import { Meteor } from 'meteor/meteor';
import { compose } from 'react-komposer';
import { getTrackerLoader, composerOptions } from '/imports/react-ui/utils';
import MainLayout from '../components/MainLayout';

function composer(props, onData) {
  onData(null, {
    loggedIn: !!Meteor.user(),
    loggingIn: Meteor.loggingIn(),
  });
}

export default compose(getTrackerLoader(composer), composerOptions({}))(MainLayout);
github erxes / erxes / imports / react-ui / settings / forms / containers / Form.js View on Github external
import { compose } from 'react-komposer';
import { getTrackerLoader, composerOptions } from '/imports/react-ui/utils';
import { Form } from '../components';

function composer({ form }, onData) {
  onData(null, {
    form,
  });
}

export default compose(getTrackerLoader(composer), composerOptions({ spinner: true }))(Form);
github erxes / erxes / imports / react-ui / layout / containers / QuickNavigation.js View on Github external
import { Meteor } from 'meteor/meteor';
import { compose } from 'react-komposer';
import { getTrackerLoader, composerOptions } from '/imports/react-ui/utils';
import QuickNavigation from '../components/QuickNavigation';

function composer(props, onData) {
  const handler = Meteor.subscribe('notifications.unreadCount');

  if (handler.ready()) {
    const unreadCount = 0;
    onData(null, { unreadCount });
  }
}

export default compose(getTrackerLoader(composer), composerOptions({}))(QuickNavigation);
github erxes / erxes / imports / react-ui / settings / brands / containers / BrandForm.js View on Github external
import { compose } from 'react-komposer';
import { getTrackerLoader, composerOptions } from '/imports/react-ui/utils';
import { BrandForm } from '../components';

function composer({ brand }, onData) {
  onData(null, {
    brand,
  });
}

export default compose(getTrackerLoader(composer), composerOptions({ spinner: true }))(BrandForm);
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);

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