7

I'm trying to use ALERTIFYJS in react but its alertify alerts are not working. Below is the code

(window.alert is working fine on my browser)

import alertify from 'alertifyjs';

clickHandle = () => {
  alertify.alert('Alert Title', 'Alert Message!', function(){ 
    alertify.success('Ok'); 
  });
}
Sultan Aslam
  • 5,600
  • 2
  • 38
  • 44

2 Answers2

14

Need to add the css file too. Problem Solved.

import 'alertifyjs/build/css/alertify.css';
Sultan Aslam
  • 5,600
  • 2
  • 38
  • 44
4

Yes, You have to add css file as well.

Here is the process for adding css and importing alertify

import alertify from 'alertifyjs';
import 'alertifyjs/build/css/alertify.css';

or

import * as alertify from 'alertifyjs';
import 'alertifyjs/build/css/alertify.css';

Please note I have tested this code on react js 16.13.1 with restify 1.13.1

Sultan Aslam
  • 5,600
  • 2
  • 38
  • 44
SohanLal Saini
  • 408
  • 1
  • 3
  • 13