showing 15 lessons...
The FizzBuzz problem is commonly presented as the lowest level of comprehension required to illustrate adequacy in computer programming.
In this lesson you learn about the problem as well as its solution in TypeScript. We will also cover some tricks on approaching the problem and coding interview questions in general.
TypeScript is very particular about what is and isn't allowed in a TS file to protect you from common developer errors. By default if you set the compile target to ES5 it only allows you to use globally defined variables that were available in the ES5 time-frame. That said it is super easy to configure TypeScript to use ES6 or ESNext using the
We also cover how to make sure that these features work across the widest range of browsers using a simple polyfill.
You can create stateful React Components in TypeScript by extending from the React.Component class. This parent class takes two generic parameters, Props and State.
This lessons shows these generic parameters and React.Component in action
TypeScript tries to infer as much about your code as it can.
But sometimes there really is not enough context for it to infer reliably. If it tried to do such inference it would potentially result in more nuisance than help. So instead it infers the type
any. This type can catch people off guard as it provides very little type safety. Fortunately TypeScript has a flag to make it easier to catch such unsafe code at development time.
You can create a stateless React component in TypeScript by just creating a function.
But if you want to create high quality idiomatic React + TypeScript components you should use the
React.StatelessComponent interface. This is demonstrated in the video.
Programming language design does have a concept of bottom type that is a natural outcome as soon as you do code flow analysis. TypeScript does code flow analysis (😎) and so it needs to reliably represent stuff that might never happen. This is what the never type is all about.
Learn how to write a promise based delay function and then use it in async await to see how much it simplifies code over setTimeout.
Lets say you want to call a function after 1s, 2s, 3s. You can use setTimeout, or you can wrap it up into a simple delay function that works with async/await
React loves svg just as much as it loves html. In this lesson we cover how simple it is to make SVG components in ReactJS.
Creating SVG components with React allows you to inline SVG. Inline SVG has an advantage that it can be styled with CSS just like the rest of your webpage and doesn't need a separate web request to load.
An additional advantage is of-course that you can use component props to customize the contents of the SVG.