Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ryansolid
Last active June 22, 2022 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryansolid/79c7dacfd22b132ecc7d50780620833c to your computer and use it in GitHub Desktop.
Save ryansolid/79c7dacfd22b132ecc7d50780620833c to your computer and use it in GitHub Desktop.
Component Register React
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment