React with TypeScript

     I've had quite a time trying to code things in TypeScript with React, somehow I thought it would have been so much simpler. This is a blog about my experience as I learn, so I won't be afraid to admit that I've had a difficult time trying to build a relatively simple program in React using TypeScript. Many things are very similar to classic JavaScript, but I've especially had a hard time trying to get data from an API. Currently, every time I make my API call I get errors relating to how a promise is unfulfilled. I am awaiting my response and getting it's data before I do anything with it, but it seems like the await doesn't actually do anything at all.

    I am trying to rebuild the simple GitHub Cards app that I built while I was learning React. In React I never had any issues with promise fulfillment, since the awaits seemed to work exactly as I expected. With TypeScript, it took me a while to figure out how to pass a function down to a component. Finally I figured that out and more things started clicking (correctly assigning types to variables was helpful), but when I finally had something put together that would display on my screen, I went to test it and got my
"Uncaught (in promise) Error: Request aborted" error.

    I plan to make a new blog entry when I resolve this error, I have some friends I can ask to put some new eyes on my issue, and I may need to read deeper into the only real React-TypeScript book I know of. For now, you can check out the code here.

Comments

Popular posts from this blog

Reviewing WPF and MVVM

Using WebRTC to build a videophone in React and TypeScript

Learning Flutter