axios .get(`${window.location.pathname}`) .then(res => { console.log(res); const { name, email } = res.data[0]; this.setState({ name, email }); }) .catch(err => console.log(err));
fetch(window.location.pathname) .then(res => { console.log(res); const { name, email } = res.data[0]; this.setState({ name, email }); }) .catch(err => console.log(err));