component-register-react

0.0.6 • Public • Published

Component Register React

This is a Component Register HOC (decorator/mixin) to support React Components. Component props are passed through as React props.

import { register, compose } from 'component-register'
import withReact from 'component-register-react'
import React, { Component }  from 'react'
 
// Normal React Component
class MyComponent extends Component {
  constructor(props) {
    this.state = {greeting: 'Hello'}
  }
 
  render() {
    return <div>{this.state.greeting + ' ' + this.props.recipient}</div>
  }
}
 
export default compose(
  register('my-component', {recipient: 'John'})
  withReact
)(MyComponent)

This library also supports Stateless pure function components.

Readme

Keywords

none

Package Sidebar

Install

npm i component-register-react

Weekly Downloads

5

Version

0.0.6

License

MIT

Unpacked Size

4.13 kB

Total Files

5

Last publish

Collaborators

  • ryansolid