I am trying to use some jQuery UI functionality in my reactJS/Redux application. I've imported both jQuery and jQuery UI using:
npm install jquery jquery-ui
And then I've tried:
import $ from 'jquery';
import jQuery from 'query';
import jQuery-ui from 'jquery-ui';
However jQuery UI does not seem to be imported when I try to do something like:
componentDidMount() {
$('ol#myList').selectable();
}
I believe the issue is with jQuery UI. What am I doing wrong? How can I get jQuery UI to work with this stack?
Thank you!
I'm successfully using partial import from jquery-ui. I mean import to my module only what I needed from jquery-ui:
( But take in account that I'm using webpack https://webpack.github.io/, in other environment approach may differ)
Add a alias in webpack config:
Save them in package.json:
Then
It work for me with the last jquery(3.2.1) and jquery-ui(1.12.1).
See my blog for detail: http://code.tonytuan.org/2017/03/webpack-import-jquery-ui-in-es6-syntax.html
I first,
When I need it, I
component name is jqueryui (no hyphen), use
import jqueryui from 'jquery-ui'
or simplyimport 'jquery-ui'