fetch API

React

基本的な使い方

fetch('https://sample.com/')
    .then( res => res.json() )
    .then( data => { console.log(data) })
    .catch( error => { console.error(error) })

AJAXとの違い

使い勝手が良いので主流はfetch API

BACK