Helpful React Types
Hooks
1// add type before parens2React.useState<boolean>(false)3React.useRef<HTMLDivElement>(null)4React.useCallback(5 function() {6 if (theMoon) {7 setSomethingAwesome()8 }9 },10 [theMoon]11)
Props
1type FooProps = {2 children: React.ReactNode3}
Components
1// functional2const Foo: React.FC<FooProps> = (props) => ()3// class4class Foo extends React.Component<FooProps> {}
emotion
1const Foo = styled<FooProps>.div``;