Adding Flow - Phizzard/Reactbase-cms GitHub Wiki

Flow is a static type checker that helps you write code with fewer bugs. Check out this introduction to using static types in JavaScript if you are new to this concept.

Recent versions of Flow work with Create React App projects out of the box.

To add Flow to a Create React App project, follow these steps:

  1. Run npm install --save flow-bin (or yarn add flow-bin).
  2. Add "flow": "flow" to the scripts section of your package.json.
  3. Run npm run flow init (or yarn flow init) to create a .flowconfig file in the root directory.
  4. Add // @flow to any files you want to type check (for example, to src/App.js).

Now you can run npm run flow (or yarn flow) to check the files for type errors. You can optionally use an IDE like Nuclide for a better integrated experience. In the future we plan to integrate it into Create React App even more closely.

To learn more about Flow, check out its documentation.