An open API service indexing awesome lists of open source software.

https://github.com/meteor/meteor-reactjs

ReactJS + addons + JSX (--harmony) for Meteor
https://github.com/meteor/meteor-reactjs

Last synced: 5 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# meteor-reactjs

[![Join the chat at https://gitter.im/hipertracker/meteor-reactjs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hipertracker/meteor-reactjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[Meteor](http://meteor.com) smart package integrating [React](http://facebook.github.io/react/) for both client and the server, to complement or replace the default [Blaze](https://www.meteor.com/blaze) templating system. [React.addons](http://facebook.github.io/react/docs/addons.html) are enabled. [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) 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:

```js
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](https://github.com/hipertracker/meteor-reactjs-examples).

## Credits

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