In popular programming languages like Java and C#, generics serve as one of the tools for creating reusable components. By using generics, the programmer is able to create safe classes and functions that can operate on objects of various types.

Similarly, Flow offers generics as a way of type abstraction. Check out the docs on the official website to learn the basics. In this article, I want to give you an example of how we use Flow Generics with React components at Coursera.

ItemSelector component

Imagine you want to build a course selector component, consisting of checkboxes and course labels. A user…

Quang Tran

Software Engineer at Airbnb. ex Coursera

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store