# CommonEdge Interview with Jarrett ## Smidgeon of Typescript ```typescript= const f = <A,B>(x: A): B => /* ... */; const g = <B,C>(y: B): C => /* ... */; const h = <A,C>(x: A): C => g(f(x)); ``` ```typescript= const ListView = <T>(items: T[]) => new React.Element(...); ``` const { data: gpsCoords, isLoading } = useGpsPoints(); const { data: } = useUser(); ## React References ## State Handling Preferences Started out with lots of context, moved to prop drilling. Kent C Dodds ```typescript= // create context // default object // build your reducer // exported context provider // reducer function and state // export useContext query // function setThis() setThat() setReset() // event dispatch({ type: 'EVENT' }) interface NumEditProps { currentValue: number; update: (x: number): void; } const NumberEditor = (ps: NumEditProps) => { } const handle = (x: numbmer) => state.set(x => x+=num); handle === handle; // true handle !== (x: numbmer) => state.set(x => x+=num); // false <NumberEditor currentValue={3} update={handle}></NumberEditor>