Check out example codes for "how to delete elements in figma". It will help you in understanding the concepts better.

Code Example 1

Select an element, then hit backspace to delete.

Learn ReactJs, React Native from akashmittal.com