[SOLVED] useMoralisSubscription react hook issue in demo apps

Hello, I am trying to test and use the subscription hook useMoralisSubscription in react frontend locally with this https://github.com/MoralisWeb3/demo-apps/blob/main/react-moralis-examples/src/modules/Subscription.tsx but, its not working, there are no instruction to follow to make it work, what needs to be done is unclear from documentation. Here is the msg given in demo app for subscription sample.

I tried to search usecases for subscription but could not find anything in docs like working example etc. Can anybody help me with any links or working sandbox example to utilise the subscription hook.

Thanks in advance.

what you mean by the fact that it is not working? what is happening and what would you expect to happen?

from that code it looks like you should get an alert when you add a new entry in GameScore table

1 Like

@cryptokid Actually, I did not understand that demo example given for subscription hook, as I did not have GameScore table before and there were no instructions to create it, so I spent time to understand n run the casino sample app and deployed its contract for that in order to receive the events using subscription. So, for casino Im now getting subscription events for β€˜flip’ event.

Sorry if it was not clear from my question, but thanks for replying. Appreciate it.

interface GameScore {
  playerName: string;
  score: number;

you could test with a table that has those 2 columns: playerName and score.
I’ll test it later too.

1 Like

@cryptokid Yes, I got it now, thank you so much. :slightly_smiling_face:

1 Like