How to import jQuery in a React component?
My JS file containing jQuery (apiCalls.js): function getBlogInfo() { $.ajax({ url: "http://api.tumblr.com/v2/blog/myblog.tumblr.com/info?api_key=my-api-key", dataType: 'jsonp', success: function(info){ console.log(info); console.log(info.response.blog.likes); } } )} export { getBlogInfo }; My React component: import React, { Component } from 'react'; import $ from 'jquery'; import { getBlogInfo } from './scripts/apiCalls'; class Homepage extends Component { componentDidMount(){ getBlogInfo(); } render() { return ( <div className="homepage"> </div> ); } } export default Homepage; If I replace t
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.