Typed React and Redux

added by bpwndaddy
9/30/2015 1:33:06 AM

1356 Views

The release of TypeSciprt 1.6 includes support for React components. I decided to give it a whirl and see what TypeScript has to offer. The end result is a port of the Redux TodoMVC example to TypeScript. (See my repo on GitHub) So why use types in the first place? Isn’t the dynamic and flexible nature of JavaScript what makes it so great in the first place? As strange as it sounds, I actually believe that adding more constraints to the system can result in more freedom. Of course, the type system has to be powerful and flexible enough to not get in your way. This post is meant for developers who work with JavaScript and has an interest in TypeScript and React. I will be showing examples using the Redux framework, but it is not a requirement. No prior knowledge of TypeScript is required, but you should have some familiarity with React. I will cover the following topics: What are types, and why we need them? How TypeScript can help us develop React applications. Additional considerations when choosing TypeScript and React. Disclosure: I’m not an expert in TypeScript. If you have any suggestions for improvement, please leave a comment!


0 comments