Typing with React
#
In order to encourage people to support my work, I’ve decided to publish a TL;DR version of this chapter for the community. This will allow me to develop more content, so it’s a win-win really.
You can access the full chapter by buying a copy through Leanpub↗. It goes into detail, whereas the following should give you a rough idea of the chapter contents.
TL;DR
#
- propTypes↗ are great. Use them to improve the maintainability of your application.
propTypes
give you nice little errors during development, but will be stripped from the production build to improve performance.- Flow↗ goes one step further. It provides syntax that allows you to gradually type your JavaScript code.
- While
flow
itself is a static checker you have to run separately, babel-plugin-typecheck↗ provides runtime checks during development. - Microsoft’s TypeScript↗ is yet another alternative. Starting from the version 1.6 it will gain JSX support.
Buy the book↗ for the rest.