Im trying to learn react and next js. I wanna use this plugin. I installed that with npm but i dont know how to import it.
How i'm gonna use npm installed packages in my code?
Here is the code...
import React from 'react';
import VirtualSelect from 'virtual-select-plugin';
function Options() {
VirtualSelect.init({
ele: '#sample-select',
options: [
{ label: 'Options 1', value: '1' },
{ label: 'Options 2', value: '2' },
{ label: 'Options 3', value: '3' },
],
});
return <div className='container mx-auto lg:px-10 px-5 mt-10'>
<h2>Options</h2>
<div>
<div>
<h3>Genre</h3>
<div id="sample-select"></div>
</div>
<div>
<h3>Year</h3>
</div>
<div>
<h3>Seasons</h3>
</div>
</div>
</div>;
}
export default Options;
error message:
./components/Options.js:2:0
Module not found: Can't resolve 'virtual-select-plugin'
1 | import React from 'react';
> 2 | import VirtualSelect from 'virtual-select-plugin';
3 |
4 | function Options() {
5 |
Import trace for requested module:
./pages/index.js
https://nextjs.org/docs/messages/module-not-found