JSFiddle - React, Tailwind, and code Playground

JavaScript

require([
    'dojo/request/xhr',
    'dojo/aspect'
], function(xhr, aspect) {
    aspect.before(xhr, 'post', function() {
        console.log('before POST');
        console.log(xhr);
    });
    
    xhr.post('/echo/json/', {
            data: {
                json: JSON.stringify({
                    key: 'value'
                })
            },
            handleAs: 'json'})
        .then(function(data) {
            console.log('received data', data);
        });
});