Skip to content

4commerce-technologies-AG/meteor-package-blaze-as-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

4commerce:blaze-as-react

This meteorjs package allows you to use Blaze templates as and inside React components.


### Installation

You can add this package to your meteor app like any other package from atmosphere

$ meteor add 4commerce:blaze-as-react

Usage

This package registers the function Template.AsReactComponent() and the property React.BlazeView.


##### Sample template

foo.html:

<template name="foo">
  <div>
    <p>Hello world!: {{bar}}
  </div>
</template>

##### use React.BlazeView

about.jsx:

var pageAbout = React.createClass({
  render() {
    return (
      <div>
        <React.BlazeView template="foo" bar="Send from React ..." />
      </div>
    );
  }
});

##### use Template.AsReactComponent()

about.jsx:

var Foo = Template.AsReactComponent('foo');

var pageAbout = React.createClass({
  render() {
    return (
      <div>
        <Foo bar="Send from React ..." />
      </div>
    );
  }
});

You may decide which method fits your needs best.
> Attention: If you use `Template.AsReactComponent` don't name your var starting with lowercase character like `foo` or `myFoo` etc. In that case React will not use that variable as a component. > > var foo = Template.AsReactComponent('foo'); > ... > <foo bar="Send from React ..." /> > > does not work!

Package dependencies

When you add this package, follwing dependencies will load:

  1. underscore
  2. templating
  3. react-runtime

Related links

  1. Meteor Forum: Smoothly feature up your Blaze Apps with React Components
  2. Read the docs: React in Meteor
  3. Meteor on github: React packages

Issues & help

In case of support or error please report your issue request. The issue tracker is available at: https://github.com/4commerce-technologies-AG/meteor-package-blaze-as-react/issues


Author & Credits

Author: Tom Freudenberg, 4commerce technologies AG

Copyright (c) 2015 Tom Freudenberg, 4commerce technologies AG, released under the MIT license

I found a number of ressources on the internet doing something similar but not completely. So I took all here together in this new package. Thanks to all unlisted authors for their inspiration.

About

meteorjs package – use Blaze templates as and inside React components.

Resources

License

Stars

Watchers

Forks

Packages

No packages published