🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

sweetalert2-react

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sweetalert2-react

Declarative SweetAlert 2 in React

Source
npmnpm
Version
0.5.0
Version published
Maintainers
1
Created
Source

sweetalert2-react

NPM version Dependency Status

Declarative SweetAlert in React

Introduction

This package is forked from https://github.com/chentsulin/sweetalert-react and adopted for https://github.com/limonte/sweetalert2

Install

$ npm install sweetalert2-react

Usage

import React, { Component } from 'react';
import SweetAlert from 'sweetalert2-react';

// ...

render() {
  return (
    <div>
      <button onClick={() => this.setState({ show: true })}>Alert</button>
      <SweetAlert
        show={this.state.show}
        title="Demo"
        text="SweetAlert in React"
        onConfirm={() => this.setState({ show: false })}
      />
    </div>
  );
}

You should import sweetalert2.css from 'sweetalert2-react/src/sweetalert2.css'.

Checkout full examples https://github.com/chentsulin/sweetalert-react

Tests

Test were not updated to support sweetalert2. PRs are welcome.

License

MIT © C.T. Lin

Keywords

alert

FAQs

Package last updated on 09 Sep 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