WP Rest API feature image breaking react component

Resolved!

If no feature image exists, then _embedded[‘wp:featuredmedia’] is not used.

To resolve, the prop value needs to be wrapped into a conditional.

<Post
key={post?.id}
id={post?.id}
title = {post?.title.rendered}
link = {post?.link}
img = {post && post._embedded && post._embedded['wp:featuredmedia'] ? post._embedded['wp:featuredmedia'][0].source_url : ' ' }
category = {post?.categories}
/>