Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 2b2b8ff

Browse files
authored
Replace the Flow documentation section (#1245)
1 parent ccdaa60 commit 2b2b8ff

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

packages/react-scripts/template/README.md

+10-17
Original file line numberDiff line numberDiff line change
@@ -444,28 +444,21 @@ Now you are ready to use the imported React Bootstrap components within your com
444444

445445
## Adding Flow
446446

447-
Flow typing is currently [not supported out of the box](https://github.com/facebookincubator/create-react-app/issues/72) with the default `.flowconfig` generated by Flow. If you run it, you might get errors like this:
447+
Flow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.
448448

449-
```js
450-
node_modules/fbjs/lib/Deferred.js.flow:60
451-
60: Promise.prototype.done.apply(this._promise, arguments);
452-
^^^^ property `done`. Property not found in
453-
495: declare class Promise<+R> {
454-
^ Promise. See lib: /private/tmp/flow/flowlib_34952d31/core.js:495
449+
Recent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box.
455450

456-
node_modules/fbjs/lib/shallowEqual.js.flow:29
457-
29: return x !== 0 || 1 / (x: $FlowIssue) === 1 / (y: $FlowIssue);
458-
^^^^^^^^^^ identifier `$FlowIssue`. Could not resolve name
459-
```
451+
To add Flow to a Create React App project, follow these steps:
460452

461-
To fix this, change your `.flowconfig` to look like this:
453+
1. Run `npm install --save-dev flow-bin`.
454+
2. Add `"flow": "flow"` to the `scripts` section of your `package.json`.
455+
3. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).
462456

463-
```ini
464-
[ignore]
465-
<PROJECT_ROOT>/node_modules/fbjs/.*
466-
```
457+
Now you can run `npm run flow` to check the files for type errors.
458+
You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.
459+
In the future we plan to integrate it into Create React App even more closely.
467460

468-
Re-run flow, and you shouldn’t get any extra issues.
461+
To learn more about Flow, check out [its documentation](https://flowtype.org/).
469462

470463
## Adding Custom Environment Variables
471464

0 commit comments

Comments
 (0)