Why I can't do this
import { getData as get } from "axios";
so that I can use getData as an alias of get?
getData('url').then(resp)
else I have to do axios.get('url')
Check this code and see the import statement
import { get as getData } from "axios"; class TestJs extends React.Component { componentWillMount(){ getData('https://data.fixer.io/api/latest').then(function(resp){ console.log(resp) }); } render() { return ( <div> Hello World </div> ); } } export default TestJs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.