joyboy
joyboy copied to clipboard
Refactor useNostr hook
OD Hack
This issue is part of ODHack 4.0:
description - https://x.com/OnlyDust_com/status/1791035111992934563 guidelines - https://onlydust.notion.site/ODHack-Common-Guidelines-Project-leads-5e21836f85ad493f9ca429770af0ad40
Please read the guidelines and make sure you follow them.
Please write your thoughts and how long you think it will take to complete the issue in the comments.
Refactor useNostr hook
useNostr hook should have it's own Context and Provider using React Context API. This will allow us to use it in multiple components without having to create multiple instances of the pool and ndk. Hook should use Tanstack Query to fetch data from the Nostr pool and mutate the pool. This means it is required to setup Tanstack Query, create a new Context for the pool and ndk, and refactor every usage of the hook.
In short, these tasks must be done:
- Setup Tanstack Query
- Create a new Context for the pool and ndk
- Create new hooks to fetch and mutate data by following the useNostr hook
- Refactor every usage of the useNostr hook to use new hooks
Please battle test it before doing a PR.
Communication
https://t.me/JoyboyStarknet/949
May the Joy be with you!