Skip to content

hipertracker/meteor-reactjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meteor-reactjs

Meteor smart package integrating React for both client and the server, to complement or replace the default Blaze templating system. React.addons are enabled. JSX is using ES6 transforms (--harmony) as well.

Usage

Inside your Meteor project, add the package:

$ meteor add hipertracker:reactjs

How it works

The package exposes a special ReactMeteor.Mixin object that can be used to enable reactive data fetching for your React components.

To add the ReactMeteor.Mixin to a React component, simply include it in the mixins class property:

var MyComponent = React.createClass({
  mixins: [ReactMeteor.Mixin],

  // Make sure your component implements this method.
  getMeteorState() {
    return {
      foo: Session.get("foo"),
      ...
    };
  }
});

The getMeteorState method should return an object of properties that will be accessed via this.state in the component's render method or elsewhere. Dependencies will be registered for any data accesses performed by getMeteorState so that the component can be automatically re-rendered whenever the data changes.

You can find some examples at hipertracker/meteor-reactjs-examples.

Credits

The source code is based on reactjs/react-meteor. It has been updated to the latest Meteor and React version with enabled ES6 transforms for JSX files (--harmony).

About

ReactJS + addons + JSX (--harmony) for Meteor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •