Comments (9)
I found a simpler solution, require jquery like this:
import OwlCarousel from 'react-owl-carousel';
const $ = require('jquery');
and you can use $ wherever you want in your component (tested in my code)
from react-owl-carousel.
Ok, i see your problem now...
I found this answer that might help you it's very similar to what you were doing, try to see if it works for you:
https://stackoverflow.com/questions/44088235/how-to-use-jquery-dependant-plugins-in-create-react-app
from react-owl-carousel.
Thanks, @rainst for your great solutions kindly let me try them.
Thanks again :)
from react-owl-carousel.
是不是这个插件只能在webpack中使用?因为之前在webpack中使用是没问题的
from react-owl-carousel.
The version of jquery is 3.3.1, the version of react is 16.3, which meets the requirements, but it is still reported fn undefined. How to deal with this situation?
Same problem here
from react-owl-carousel.
fn undefined usually means jquery is not defined.. how are you including jquery in your project??
from react-owl-carousel.
@rainst I am using the jquery like this
import OwlCarousel from 'react-owl-carousel';
import $ from 'jquery';
window.jQuery = $;
window.$ = $;
global.jQuery = $;
but i am still facing the issue
TypeError: Cannot read property 'fn' of undefined react
Can you please help me on this, please...?
jquery version is 3.4.0
from react-owl-carousel.
Hi @usamamashkoor,i think you are not doing it right..
I guess that when you are doing this:
window.jQuery = $;
window.$ = $;
global.jQuery = $;
you are trying to expose jquery in the react component, but that's not the proper way of doing it, try to see if this solution is working:
https://stackoverflow.com/questions/45693800/how-to-use-a-jquery-dependent-node-module-in-react-js
from react-owl-carousel.
Thanks, @rainst but can you please let me know how can I add a plugin in web pack in create react app...?
from react-owl-carousel.
Related Issues (20)
- How to filter? HOT 1
- Not able to update state variable on onChanged callback , gives error 'unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering' HOT 1
- Add Typescript support
- index.js:1 Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code.
- UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. | Please update the following components: ReactOwlCarousel HOT 9
- window is not defined HOT 1
- SlideTransition prop doesn't exist in react
- Bank white page issue HOT 2
- autoHeightClass doesnt work
- react-owl-carousel mobile issue - one slide getting place at the top of the another slide at arr HOT 1
- i can't use methods HOT 1
- carousel installed but not working
- How to call the animateOut/ animateIn properly
- navContainer not working
- jQuery cannot see $
- dotData not working
- Blank OwlCarousel : items moved from .owl-stage to .owl-carousel when resize the window mobile
- Warning: Invalid DOM property `class`. Did you mean `className` HOT 1
- UNSAFE_componentWillReceiveProps HOT 6
- Fails to install in React 17 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-owl-carousel.