0

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

1 Answer 1

1

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...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.