Skip to content

Commit c2c3728

Browse files
gaearonalexdriaguine
authored andcommitted
Replace the Flow documentation section (facebook#1245)
1 parent 5e51f86 commit c2c3728

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

packages/react-scripts/template/README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -445,28 +445,21 @@ Now you are ready to use the imported React Bootstrap components within your com
445445

446446
## Adding Flow
447447

448-
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:
448+
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.
449449

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

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

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

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

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

471464
## Adding Custom Environment Variables
472465

0 commit comments

Comments
 (0)