Best way to get up to speed on Meteor 1.3?

Is this it?
https://github.com/meteor/meteor/blob/release-1.3/packages/modules/README.md

Are there other useful resources?

Also, since I’m using React, should I stop using this format:

Thing = React.createClass({
  // ...
});

in favor of:

export default class Thing extends React.Component {
  // ...
}

The official React docs still use the former, so I’m not sure which direction people are generally moving towards. My gut says probably the latter, though.

1 Like

Oops. Caveat with extending React.Component class: no mixins. Hence, you wouldn’t be able to use the ReactMeteorData mixin. No bueno!

Use react-kompser

2 Likes

Interesting stuff! I gave it a shot, but I’m getting this error:

Uncaught TypeError: _reactKomposer2.default is not a function

Code below:

import React from 'react';
import compose from 'react-komposer';

const Time = ({time}) => (<div>Time is: {time}</div>);

const onPropsChange = (props, onData) => {
  const handle = setInterval(() => {
    const time = (new Date()).toString();
    onData(null, {time});
  }, 1000);

  const cleanup = () => clearInterval(handle);
  return cleanup;
};

const Clock = compose(onPropsChange)(Time); // error on this line

export default class Home extends React.Component {
  render() {
    return <div>
      <Clock />
    </div>
  }
}

you can use the reactMixin module. npm install react-mixin

1 Like

But then use it how?

const SampleComponent = class SampleComponent extends React.Component {

}

reactMixin(SampleComponent.prototype, ReactMeteorData);


2 Likes

Ahh, cool! Thanks for pointing that out. :slight_smile:

Also, since I’m using React, should I stop using this format:

Thing = React.createClass({
  // ...
});

in favor of:

export default class Thing extends React.Component {
  // ...
}

I would try and use the stateless component as much as possible. If you need the mixin support that's fine, but for the ones that only use props the stateless are really nice! Otherwise @abhiaiyer 's method works nicely!
export default (props) => (
  <div>
    Hello {props.name}!
  </div>
);
1 Like

It’s

import {compose} from 'react-komposer';
1 Like

Woops. Minor but important detail. Thanks! Are there any particular advantages of using react-komposer vs the ReactMeteorData mixin?

They are two different things.

In react-komposer you compose a new React container and pass data via props to the UI components.
It also does does some cool stuff for you like loading indicators and so on.

Check this post: Let’s Compose Some React Containers


On the other hand getMeteorData is mixin and you can manage the state inside a React component. Usually, you need to call another UI component from it.

react-komposer makes it easy to write tests and so on, because you just need to work composer function and tell how to load data.

This is the way, React community is heading to.

2 Likes

Great stuff! Thanks for the help. :slight_smile: