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
- Host: GitHub
- URL: https://github.com/meteor/meteor-reactjs
- Owner: meteor
- License: mit
- Fork: true (hipertracker/meteor-reactjs)
- Created: 2015-04-21T22:24:14.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-21T06:50:44.000Z (about 10 years ago)
- Last Synced: 2024-09-25T13:04:49.838Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 342 KB
- Stars: 2
- Watchers: 17
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# meteor-reactjs
[](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).