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

Code Example 1

voting::identity_index identities(_self, _self.value);
auto idx = identities.get_index<"byhash"_n>();
auto itr = idx.find(out);
eosio_assert(itr == identities.end(), "User already registered to vote!");

Learn ReactJs, React Native from akashmittal.com