Answers for "TypeError: JSON.stringify(...).then is not a function"

0

TypeError: JSON.stringify(...).then is not a function

fetch('http://localhost:5000/', {
    method : 'post',
    headers :{ 'Content-Type' : 'application/json'},
    body : JSON.stringify({
         userId : this.state.userId,
         password : this.state.password
   })
}).then(response => response.json())
  .then(data => {
    if(data === 'success'){
            this.props.onRouteChange('home');
    }
})
Posted by: Guest on June-10-2021

Code answers related to "TypeError: JSON.stringify(...).then is not a function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language