Hey guys,
I am currently querying a table to receive an ascending list as follows:
const { data: listedWhoopys, isFetching: fetchingListedWhoopys } =
useMoralisQuery("CreatedWhoopys", (query) =>
query.limit(100).ascending("whoopyName")
);
console.log(listedWhoopys);
I then pass this to my front end by mapping every single parameter as follows:
{listedWhoopys.map((whoopy) => {
console.log(whoopy.attributes)
const { whoopyName, whoopyColor, maxSpeed, maxHeight, interval, creatorAddress, whoopyAddress } =
whoopy.attributes
return (
<WhoopyCard
whoopyName={whoopyName}
whoopyColor={whoopyColor}
maxSpeed={maxSpeed}
maxHeight={maxHeight}
interval={interval}
creatorAddress={creatorAddress}
whoopyAddress={whoopyAddress}
playersEntered= ** HOW TO ADD THIS?
/>
)
})
WhoopyCard is a component and I pass the parameters into it as props. Everytime a new Whoopy is created, a new card is automatically created with respective parameters.
Whoopy is a game, and I would like to keep track of the people entered for every individual whoopy so that that number shows in every WhoopyCard component. However, when a player enters, the event that updates the player count is recorded in another table and not the “CreatedWhoopys” table.
Now my question is this: how can I pass the player count from the other table to the WhoopyCard component? The WhoopyAddress parameter is present in both tables, and I’d need this to ensure that the relevant WhoopyCard updates correctly. Also, while all the other parameters in the WhoopyCard are supposed to stay the same, I want the player count to keep increasing.
How can I add the player count (from the other table) as a prop in WhoopyCard so that it updates correctly?
NOTE: Both tables have been created using core_AddEventsSync since I am recording different instances of the same contract.
Please let me know if any additional info is required.
Thanks!