i have been trying to create a hook that fetches data and takes advantage of react suspense. Using the example in the page (and this article) I have created a function(i want to convert it to hook) that fetches data.
Example
Problem
Currently I can't pass data through the function as it gets executed when it is called.I want to pass data in useWrap(**HERE**)
and use it in fetchData()
Expected behaviour / Target
- I want to pass data to useWrap() and put it in fetchData()
- I want the useWrap to be a Hook in order to take advantage of basic hooks
- I want to take advantage of React Suspense
Does someone know how to accomplish these needs and tell me what am i doing wrong?
Thank you!