As first get the data from promis, and then render in the block Gutenberg?

Hello.

Writing a plugin for WP Gutenberg, and I have to get data for dropdown from promis, and then they render.

You have two options: either just `getData().then(() => { return }) ` or `await getData; return ...`.

Here's a piece my code
edit: async function (props) {

let data = await getData('...');

return [ el('div', {}, data)];
},

save: function (props) {
return [ //my elements goes here];
}


but in any case get the error that the promises cannot be used.
https://reactjs.org/docs/error-decoder.html/?invar...

Actually, the question is how to first get the data and then make a return ?
March 19th 20 at 08:29
0 answer

Find more questions by tags WordPress