New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-singleton

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-singleton

Rending a singleton react component in DOM

latest
Source
npmnpm
Version
1.3.3
Version published
Maintainers
1
Created
Source

react-singleton

Demo

You can find example in folder example

Usage with React

1、Install the package

npm install react-singleton --save

2、Import component

// ES6
import Singleton from 'react-singleton'
// ES5
var Singleton = require('react-singleton').default

###3、Decorate the target component

class Alert extends Component {...}

export default new Singleton(Alert)

###4、Using as your need

// Example 1:

import Alert from 'component/Alert'

Alert.show();
// you can pass the props with a object in show method
Alert.show({
    title: xxx,
    content: xxx
})
// destroy the DOM node
Alert.hide();

// Example 2:

import Tips from 'components/Tips'

// Tips will disappear in 2 second on default.
Tips.popup();
// You can change the timer as you need
Tips.popup({
    text: xxx
}, 3000);

Keywords

react

FAQs

Package last updated on 07 Feb 2017

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