Last active
June 22, 2022 19:23
-
-
Save ryansolid/79c7dacfd22b132ecc7d50780620833c to your computer and use it in GitHub Desktop.
Component Register React
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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