这样写ajax可以不?

来源:2-13 生命周期函数使用实例

功不唐捐终入海

2020-07-01 14:59:41

componentDidMount(){

        (async ()=>{

           try {

                const res = await  Axios.get('http://www.dell-lee.com/react/api/demo.json')

                console.log(res.data);

           }catch (e){

               console.error(e);

           }

        })()

    }


写回答

1回答

好帮手慕慕子

2020-07-01

同学你好,可以这样写的,祝学习愉快~

0

0 学习 · 10739 问题

查看课程