Expose decorate to plugins #1261

merged 1 commit into from Jan 1, 2017


None yet

3 participants


This adds the ability to require('hyper/decorate') to register your own decorators from plugins 🌟
Will allow plugins to create a React component that can be extended by other plugins.


import React, {Component} from 'react'
import decorate from 'hyper/decorate'

class MyComponent extends Component {
  render () {
    return (<div>My Component</div>)

export default decorate(MyComponent, 'MyComponent')

Then in plugin code:

import React, {Component} from 'react'
export function decorateMyComponent (MyComponent) {
  return class extends Component {
    render () {
      return (
          <MyComponent {...this.props}>
          <div>Something else</div>
@timneutkens timneutkens Expose decorate to plugins
albinekb approved these changes Dec 18, 2016 edited View changes

Awesome! Super neat 😎

@caesar caesar referenced this pull request in henrikdahl/hyper-statusline Dec 19, 2016

Plugins #1

@rauchg rauchg merged commit f6eaef9 into zeit:master Jan 1, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
@timneutkens timneutkens deleted the timneutkens:expose-decorate-plugin branch Jan 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment