Reputation: 21
I want to use external js like jQuery, lighterjs and other js inside my react project.
I dont know how to include js inside my project
Upvotes: 0
Views: 61
Reputation: 344
You can iclude CDN link from jquery in your index.html in your root directory for react JS project. Then in your component you can use 'window.$'.
componentDidMount() {
if(window.$){
window.$( document ).ready(function() {
console.log( "ready!" );
});
}
}
So, you can use any JavaScript function right away with 'window.$' prefix. Hope It will help...
Upvotes: 1