Check out example codes for "eosio multi index clear". It will help you in understanding the concepts better.

Code Example 1

template<name::raw A, typename B, typename... C> void clear_table(multi_index<A, B, C...>* table) { 
	auto it = table->begin(); 
	while (it != table->end()) { it = table->erase(it); } 
};

clear_table(&_table);

Learn ReactJs, React Native from akashmittal.com