Check out example codes for "wordpress loop over posts but exclude current post". It will help you in understanding the concepts better.

Code Example 1

$args = array(
    'numberposts' => 5,
    'offset' => 0,
    'category' => 7,
    'post__not_in' => array( $post->ID )
);
$myposts2 = get_posts($args);

Learn ReactJs, React Native from akashmittal.com