To get updates when new recipes or extras are posted, subscribe to the Atom feed, or follow @FlowCookbook. I appreciate your requests, questions, and suggestions! Please send feedback by leaving comments here, or on recipes or extras; or send messages to @FlowCookbook.
These are primers on practical patterns for Flow. I recommend using these patterns in any project that uses Flow.
(Coming soon) Uses for union types introduces a pattern for managing data that comes in different shapes. Union types are helpful for describing Redux actions, for unpacking incoming JSON data, and for passing messages over a channel. If you have been tempted to use subclasses, take a look at union types to see if they might be a better fit.
Flow & React -
This recipe demonstrates how to use Flow effectively when creating React
Including type parameters in functional and class components provides an
propTypes that can provide better safety and modularity.
(Coming soon) Flow & Redux - Flow and Redux could have been made for each other. This recipe demonstrates several patterns that are useful for building Redux action creators and reducers. This is a companion to the post on React.
Extras are not about practical patterns. In these articles we explore ideas just because they are interesting. Read these if you want to dig deeper into type theory, or to learn about Flow’s lesser-known capabilities.
(Coming soon) What are types? The short answer is, types are sets of possible values. This post gets into what that means, and shows that Flow takes more of a purist approach to types compared to most object-oriented languages.
(Coming soon) The “algebra” in “algebraic data types” - In the recipe Uses for union types I mentioned that union types are also called “sum types” or “algebraic data types”. This post gives a brief background on type algebra so that you can understand where those terms come from.
(Coming soon) Advanced algebraic data types - Union types are great, but not perfect. This post introduces an alternative formulation for sum types that allows Flow to check for missing pattern matches. It also shows that GADTs are almost possible in Flow.
Flow has inspired many programmers to put bits to screen. Here are some articles that I found to particularly helpful:
Getting started with Flow is a tutorial from the official documentation. If you don’t know where to start, start there.
Why use type-checking? And if you do, Why Use Flow? Follow that link for the answers, and learn some things that you might not know about Flow. Aria Fallah covers a lot of background, and also introduces some interesting work from Giulio Canti.