5 best libraries for making AJAX calls in #ReactJS:
  • Then( function ( response ) { // perform setState }).catch( function ( error ) { //Some error occurred }); }
  • var request = new XMLHttpRequest(); request.open( ‘GET’ , ‘/api/content’ , true ); request.onload = function ( ) { if ( this .status >= 200 && this .status < 400 ) { var data = JSON .parse( this .response); } else { console .error( ‘Response received and there was an error’ ); } }; request.onerror = function ( ) { console .
  • I doesn’t make much sense to load jQuery just to make Ajax calls, and it looks as if the trend is not to use jQuery anymore.
  • So if you have to ever test async functions like that, Fetch gets my vote.
  • This is a quick & dirty way to make AJAX calls.

Read more


ReactiveConf

@ReactiveConf: “5 best libraries for making AJAX calls in #ReactJS:” open tweet »