Check out example codes for "have_posts args". It will help you in understanding the concepts better.

Code Example 1

<?php
$args = array(
	'post__not_in'=>array($array),
    'post_type' => 'post',
    );
	
$the_query = new WP_Query($args);

if($the_query->have_posts()):

while ($the_query->have_posts()) : $the_query->the_post();
	// Process Your Statements
	//ex the_content()
	echo the_title();
endwhile;

endif;
?>

Learn ReactJs, React Native from akashmittal.com