I have a html designed by a HTML Designer. He has used nice-select.js for a dropdown menu. I imported it into my index.html and executed this :
$(document).ready(function(e){
$(".drop").niceSelect();
}
And it works fine when it is loaded in the first page. But on clicking a menu item which points to a different component, the js does not initiated here and the design does not go for that component.
Now how to use this $ function in ComponentdidMountMethod()?
I have install the jquery using npm install jquery --save and tried to use it but got an error niceSelect is not a function.
Can anyone help in this regards.
Thanks in advance.
import React, { Component } from 'react';
import{Link} from 'react-router-dom';
import $ from 'jquery';
$(".drop").niceSelect();
This gives an error nice select is not a function.
I have the same problem. I solved this problem in this way.