Gutenberg block get recent pages

Solution:

wp_get_recent_posts returns an array of post arrays by default, while get_pages returns and array of page objects. If you’re using the linked example verbatim, then you would need to replace $post_id = $post[‘ID’] with $post_id = $post->ID.