DEV Community

Calie Rushton
Calie Rushton

Posted on

Things I learned last week (19/24)

  1. In Typescript, a type object cannot be extended once it is declared, but an Interface can.

  2. You can specify the type a function should return - insert the type after the argument parentheses: const makeUser = (): User => {}

  3. CSS Modules are a really nice way to declare styles that are scoped only to certain component. This means you can use a class name more than once without fear of applying the wrong styles. Write styles in a CSS file in the same folder as your React component, the import it into the component.

  4. React Router drastically reduces the amount of state management needed in an app. Because it handles the fetching of data you don't need to do this in a useEffect or implement an isLoading state

Top comments (0)