Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 1.31 KB

README.md

File metadata and controls

23 lines (15 loc) · 1.31 KB

React_TypeScript-RandomUserAPI

PROJECT:

In this project, we display random users' profile pic, name, dob & city of residence. A very, very minimal

Title Button & UserData
display sandwiched btw & . But cool logic for the button, that fetches data from https://randomuser.me/api .

See the final deployment --> https://gcmo.github.io/React_TypeScript-RandomUserAPI/

OBJECTIVE:

I've been focusing on TypeScript, as next challenge in JavaScript land. With this project, I wanted to challenge my TS skills within React.

LEARNING CURVE:

Typescript within React is pretty straight-fowards:

  • a) Rule of Thumb(ROT) 1: just let it detect the type of a variable according to the value assigned.
  • b) but what about {props} useState, useEffect and events? Welll... you just learn what type should be assigned to them. Best resource for that: https://github.com/typescript-cheatsheets/react#reacttypescript-cheatsheets
  • c) ROT2: use interfaces for each component. Still have to decide whether its more efficient to have all the interfaces in their own file or just associated with their respective component.
  • d) Pay extra attention to API data... mostly doable with interface, but in some cases generics may work better.

CHALLENGES:

props, state,