Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive Elements

React.js components as native HTML elements

Tiny Google Polymer or Mozilla X-Tags add-on which allows to use React.js components as custom HTML elements. Also works with a native Custom Elements implementation if present.

Demo

UPD Convert Angular and Backbone views as well with MVC elements project

Example

Using component in HTML

<body>
	<my-react-component items="{window.someArray}"></my-react-component>
</body>

React component definition

/* @jsx React.DOM */
MyComponent = React.createClass({
  render: function() {
    console.log(this.props.items);
    console.log(this.props._content); // original tag contents in a <content>
    return <ul><li>React content</li></ul>;
  }
});

document.registerReact('my-react-component', MyComponent);

Find complete examples in corresponding folder.

Nesting

Original content of a custom element is injected to component as this.props._content.

<my-react-component>Hello world</my-react-component>

In this case props._content is equal to "Hello world".

NPM and Bower

  • NPM: reactive-elements
  • Bower: ReactiveElements

Dependencies

License

MIT: http://mit-license.org/

Copyright 2014 Denis Radin aka PixelsCommander

Inspired by Christopher Chedeau`s react-xtags

About

Allows to use React.js component as HTML element (web component)

Topics

Resources

Stars

695 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages