1.0.4 • Published 7 years ago

react-singleton-decorator v1.0.4

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

react-singleton-decorator

Basic

At least you need have these configs in .babelrc and install them.

// .babelrc
{
    "presets": [
      "env",
      "es2015",
      "stage-0",
      "react"
    ],
    "plugins": [
      "transform-decorators-legacy"
    ]
}

Install

npm install react-singleton-decorator --save

Use

import singleton from 'react-singleton-decorator';

@singleton
class Hello extends Component {
    render() {
        const { name } = this.props;
        return (
            <div onClick={() => this.hide()}>
                Hello, {name}!
            </div>
        )
    }
}

Hello.show({
    name: 'Lily'
});
Hello.hide();

Can use on

Alert

Modal

Message

Notification

PageLoading

Demo

npm run example

Build

npm run build
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago