You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

reactorator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactorator

decorate your components with mixins

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
3
-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

Reactorator

Mixin your mixins and decorate!

import reactorator from 'reactorator';

import { Component } from 'react';
import { state, navigation } from 'react-router';

@reactorator(state, navigation)
class Nav extends Component {
  constructor() {
    super();
  }
  
  render() {
    const path = this.getPath();
    return <h1>Hello { path }</h1>;
  }
}

Takes in mixins that add functionality. But if you try to add mixins that do have a React lifecycle prop reactorator will warn you and let you decide how to continue.

It takes mixins and adds them to the prototype of the Component using Object.assign.

There are other decorators out there that will work with React lifecycle mixins by creating a Higher Order Component but when you are using lots of mixins you end up wrapping your component several layers deep. This is meant to alliviate that pain.

Take with babel es7.classDecorators option.

Keywords

react

FAQs

Package last updated on 30 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts