Handling ajax with React

前端 未结 5 1051
南笙
南笙 2020-12-02 13:11

How should I handle ajax requests in a fairly traditional web application? Specifically with using React for views, while having a backend that handles data such as text and

5条回答
  •  天命终不由人
    2020-12-02 13:56

    You can use JavaScript Fetch API, it supports GET and POST as well, plus it has building Promises.

    fetch('/api/getSomething').then(function() {...})
    

提交回复
热议问题