4 |
5 |
6 |
7 |
16 | React App
17 |
18 |
19 |
20 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/logo.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import postcss from "postcss"
3 | import cssnext from "postcss-cssnext"
4 | import CodeMirror from "react-codemirror"
5 |
6 | import "codemirror/lib/codemirror.css"
7 | import "codemirror/mode/css/css"
8 | import "select.css/select.css"
9 |
10 | import * as samples from "./samples"
11 |
12 | const processor = (css4, callback) =>
13 | postcss([cssnext])
14 | .process(css4)
15 | .then(
16 | result => callback(result.css),
17 | ({message}) => callback(message)
18 | )
19 |
20 | const starterCSS = `:root { --pink: #f3c }
21 |
22 | .pink { color: var(--pink) }
23 | `
24 |
25 | class App extends Component {
26 | state = {
27 | input: starterCSS,
28 | output: ""
29 | }
30 |
31 | updateWithCSS =(css4) =>
32 | processor(css4, css3 =>
33 | this.setState({
34 | input: css4,
35 | output: css3
36 | })
37 | )
38 |
39 | componentDidMount() {
40 | this.updateWithCSS(this.state.input)
41 | }
42 |
43 | handleChange = (css4) => this.updateWithCSS(css4)
44 |
45 | appendSample = ({target: {value}}) =>
46 | this.updateWithCSS(this.state.input + samples[value])
47 |
48 | render() {
49 | return (
50 |
51 |
52 | cssnext
53 |
54 |
60 |
83 |
84 |
85 |
86 | CSS
87 |
88 |
93 |
94 |
95 | )
96 | }
97 | }
98 |
99 | // private
100 |
101 | const Root = props =>
102 |
103 |
104 | const Column = props =>
105 |
106 |
107 | const Heading = props =>
108 |
109 |
110 | export default App
111 |
--------------------------------------------------------------------------------
/src/samples.js:
--------------------------------------------------------------------------------
1 | export const customPropertyVar = `
2 |
3 | /*
4 | * custom properties with var()
5 | * http://cssnext.io/features/#custom-properties-var
6 | */
7 |
8 | :root { --mainColor: red }
9 |
10 | a { color: var(--mainColor) }
11 | `
12 |
13 | export const customPropertyApply = `
14 |
15 | /*
16 | * custom properties with @apply
17 | * http://cssnext.io/features/#custom-properties-set-apply
18 | */
19 |
20 | :root {
21 | --danger-theme: {
22 | color: white;
23 | background-color: red;
24 | };
25 | }
26 |
27 | .danger { @apply --danger-theme }
28 | `
29 |
30 | export const reducedCalc = `
31 |
32 | /*
33 | * reduced calc
34 | * http://cssnext.io/features/#reduced-calc
35 | */
36 |
37 | :root { --fontSize: 1rem }
38 |
39 | h1 { font-size: calc(var(--fontSize) * 2) }
40 | `
41 |
42 | export const customMediaQuery = `
43 |
44 | /*
45 | * custom media query
46 | * http://cssnext.io/features/#custom-media-queries
47 | */
48 |
49 | @custom-media --small-viewport (max-width: 30em);
50 |
51 | @media (--small-viewport) {
52 | body { font-size: 1.2rem }
53 | }
54 | `
55 |
56 | export const mediaQueryRange = `
57 |
58 | /*
59 | * media query range
60 | * http://cssnext.io/features/#media-queries-ranges
61 | */
62 |
63 | @media (width >= 500px) and (width <= 1200px) {
64 | body { font-size: 1rem }
65 | }
66 | `
67 | export const customSelector = `
68 |
69 | /*
70 | * custom selectors
71 | * http://cssnext.io/features/#custom-selectors
72 | */
73 |
74 | @custom-selector :--button button, .button;
75 |
76 | :--button { padding: .5em 1em }
77 | `
78 | export const nesting = `
79 |
80 | /*
81 | * nesting
82 | * http://cssnext.io/features/#nesting
83 | */
84 |
85 | a {
86 | /* direct nesting */
87 | & span { color: white }
88 |
89 | /* @nest rule */
90 | @nest span & { color: blue }
91 |
92 | /* media query automatic */
93 | @media (min-width: 30em) {
94 | color: yellow;
95 | }
96 | }
97 | `
98 |
99 | export const colorFunction = `
100 |
101 | /*
102 | * color() function
103 | * http://cssnext.io/features/#color-function
104 | */
105 |
106 | a { color: color(red alpha(-10%)) }
107 | a:hover { color: color(red blackness(80%)) }
108 | `
109 |
110 | export const hwbFunction = `
111 |
112 | /*
113 | * hwb() function
114 | * http://cssnext.io/features/#hwb-function
115 | */
116 |
117 | body { color: hwb(90, 0%, 0%, 0.5) }
118 | `
119 | export const grayFunction = `
120 |
121 | /*
122 | * gray() function
123 | * http://cssnext.io/features/#gray-function
124 | */
125 |
126 | .foo { color: gray(85) }
127 | .bar { color: gray(10%, 50%) }
128 | `
129 |
130 | export const rrggbbaaColors = `
131 |
132 | /*
133 | * #rrggbbaa color
134 | * http://cssnext.io/features/#rrggbbaa-colors
135 | */
136 |
137 | body { background: #9d9c }
138 | `
139 | export const filterProperty = `
140 |
141 | /*
142 | * filter property
143 | * http://cssnext.io/features/#filter-property
144 | */
145 |
146 | .blur { filter: blur(4px) }
147 | `
148 |
149 | export const anyLinkPseudoClass = `
150 |
151 | /*
152 | * :any-link pseudo-class
153 | * http://cssnext.io/features/#any-link-pseudo-class
154 | */
155 |
156 | nav :any-link { background-color: yellow }
157 | `
158 |
159 | export const matchesPseudoClass = `
160 |
161 | /*
162 | * :matches pseudo-class
163 | * http://cssnext.io/features/#matches-pseudo-class
164 | */
165 |
166 | p:matches(:first-child, .special) { color: red }
167 | `
168 |
169 | export const notPseudoClass = `
170 |
171 | /*
172 | * :not pseudo-class
173 | * http://cssnext.io/features/#not-pseudo-class
174 | */
175 |
176 | p:not(:first-child, .special) { color: red }
177 | `
178 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
2 |
3 | Below you will find some information on how to perform common tasks.
4 | You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
5 |
6 | ## Table of Contents
7 |
8 | - [Updating to New Releases](#updating-to-new-releases)
9 | - [Sending Feedback](#sending-feedback)
10 | - [Folder Structure](#folder-structure)
11 | - [Available Scripts](#available-scripts)
12 | - [npm start](#npm-start)
13 | - [npm test](#npm-test)
14 | - [npm run build](#npm-run-build)
15 | - [npm run eject](#npm-run-eject)
16 | - [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)
17 | - [Installing a Dependency](#installing-a-dependency)
18 | - [Importing a Component](#importing-a-component)
19 | - [Adding a Stylesheet](#adding-a-stylesheet)
20 | - [Post-Processing CSS](#post-processing-css)
21 | - [Adding Images and Fonts](#adding-images-and-fonts)
22 | - [Using the `public` Folder](#using-the-public-folder)
23 | - [Adding Bootstrap](#adding-bootstrap)
24 | - [Adding Flow](#adding-flow)
25 | - [Adding Custom Environment Variables](#adding-custom-environment-variables)
26 | - [Can I Use Decorators?](#can-i-use-decorators)
27 | - [Integrating with a Node Backend](#integrating-with-a-node-backend)
28 | - [Proxying API Requests in Development](#proxying-api-requests-in-development)
29 | - [Using HTTPS in Development](#using-https-in-development)
30 | - [Generating Dynamic `` Tags on the Server](#generating-dynamic-meta-tags-on-the-server)
31 | - [Running Tests](#running-tests)
32 | - [Filename Conventions](#filename-conventions)
33 | - [Command Line Interface](#command-line-interface)
34 | - [Version Control Integration](#version-control-integration)
35 | - [Writing Tests](#writing-tests)
36 | - [Testing Components](#testing-components)
37 | - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries)
38 | - [Initializing Test Environment](#initializing-test-environment)
39 | - [Focusing and Excluding Tests](#focusing-and-excluding-tests)
40 | - [Coverage Reporting](#coverage-reporting)
41 | - [Continuous Integration](#continuous-integration)
42 | - [Disabling jsdom](#disabling-jsdom)
43 | - [Experimental Snapshot Testing](#experimental-snapshot-testing)
44 | - [Deployment](#deployment)
45 | - [Building for Relative Paths](#building-for-relative-paths)
46 | - [GitHub Pages](#github-pages)
47 | - [Heroku](#heroku)
48 | - [Modulus](#modulus)
49 | - [Netlify](#netlify)
50 | - [Now](#now)
51 | - [Surge](#surge)
52 | - [Something Missing?](#something-missing)
53 |
54 | ## Updating to New Releases
55 |
56 | Create React App is divided into two packages:
57 |
58 | * `create-react-app` is a global command-line utility that you use to create new projects.
59 | * `react-scripts` is a development dependency in the generated projects (including this one).
60 |
61 | You almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`.
62 |
63 | When you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically.
64 |
65 | To update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions.
66 |
67 | In most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes.
68 |
69 | We commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly.
70 |
71 | ## Sending Feedback
72 |
73 | We are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues).
74 |
75 | ## Folder Structure
76 |
77 | After creation, your project should look like this:
78 |
79 | ```
80 | my-app/
81 | README.md
82 | node_modules/
83 | package.json
84 | public/
85 | index.html
86 | favicon.ico
87 | src/
88 | App.css
89 | App.js
90 | App.test.js
91 | index.css
92 | index.js
93 | logo.svg
94 | ```
95 |
96 | For the project to build, **these files must exist with exact filenames**:
97 |
98 | * `public/index.html` is the page template;
99 | * `src/index.js` is the JavaScript entry point.
100 |
101 | You can delete or rename the other files.
102 |
103 | You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.
104 | You need to **put any JS and CSS files inside `src`**, or Webpack won’t see them.
105 |
106 | Only files inside `public` can be used from `public/index.html`.
107 | Read instructions below for using assets from JavaScript and HTML.
108 |
109 | You can, however, create more top-level directories.
110 | They will not be included in the production build so you can use them for things like documentation.
111 |
112 | ## Available Scripts
113 |
114 | In the project directory, you can run:
115 |
116 | ### `npm start`
117 |
118 | Runs the app in the development mode.
119 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
120 |
121 | The page will reload if you make edits.
122 | You will also see any lint errors in the console.
123 |
124 | ### `npm test`
125 |
126 | Launches the test runner in the interactive watch mode.
127 | See the section about [running tests](#running-tests) for more information.
128 |
129 | ### `npm run build`
130 |
131 | Builds the app for production to the `build` folder.
132 | It correctly bundles React in production mode and optimizes the build for the best performance.
133 |
134 | The build is minified and the filenames include the hashes.
135 | Your app is ready to be deployed!
136 |
137 | ### `npm run eject`
138 |
139 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
140 |
141 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
142 |
143 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
144 |
145 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
146 |
147 | ## Displaying Lint Output in the Editor
148 |
149 | >Note: this feature is available with `react-scripts@0.2.0` and higher.
150 |
151 | Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.
152 |
153 | They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.
154 |
155 | You would need to install an ESLint plugin for your editor first.
156 |
157 | >**A note for Atom `linter-eslint` users**
158 |
159 | >If you are using the Atom `linter-eslint` plugin, make sure that **Use global ESLint installation** option is checked:
160 |
161 | >
162 |
163 | Then add this block to the `package.json` file of your project:
164 |
165 | ```js
166 | {
167 | // ...
168 | "eslintConfig": {
169 | "extends": "react-app"
170 | }
171 | }
172 | ```
173 |
174 | Finally, you will need to install some packages *globally*:
175 |
176 | ```sh
177 | npm install -g eslint-config-react-app@0.3.0 eslint@3.8.1 babel-eslint@7.0.0 eslint-plugin-react@6.4.1 eslint-plugin-import@2.0.1 eslint-plugin-jsx-a11y@2.2.3 eslint-plugin-flowtype@2.21.0
178 | ```
179 |
180 | We recognize that this is suboptimal, but it is currently required due to the way we hide the ESLint dependency. The ESLint team is already [working on a solution to this](https://github.com/eslint/eslint/issues/3458) so this may become unnecessary in a couple of months.
181 |
182 | ## Installing a Dependency
183 |
184 | The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`:
185 |
186 | ```
187 | npm install --save
188 | ```
189 |
190 | ## Importing a Component
191 |
192 | This project setup supports ES6 modules thanks to Babel.
193 | While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
194 |
195 | For example:
196 |
197 | ### `Button.js`
198 |
199 | ```js
200 | import React, { Component } from 'react';
201 |
202 | class Button extends Component {
203 | render() {
204 | // ...
205 | }
206 | }
207 |
208 | export default Button; // Don’t forget to use export default!
209 | ```
210 |
211 | ### `DangerButton.js`
212 |
213 |
214 | ```js
215 | import React, { Component } from 'react';
216 | import Button from './Button'; // Import a component from another file
217 |
218 | class DangerButton extends Component {
219 | render() {
220 | return ;
221 | }
222 | }
223 |
224 | export default DangerButton;
225 | ```
226 |
227 | Be aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes.
228 |
229 | We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`.
230 |
231 | Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.
232 |
233 | Learn more about ES6 modules:
234 |
235 | * [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281)
236 | * [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html)
237 | * [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules)
238 |
239 | ## Adding a Stylesheet
240 |
241 | This project setup uses [Webpack](https://webpack.github.io/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:
242 |
243 | ### `Button.css`
244 |
245 | ```css
246 | .Button {
247 | padding: 20px;
248 | }
249 | ```
250 |
251 | ### `Button.js`
252 |
253 | ```js
254 | import React, { Component } from 'react';
255 | import './Button.css'; // Tell Webpack that Button.js uses these styles
256 |
257 | class Button extends Component {
258 | render() {
259 | // You can use them as regular CSS styles
260 | return ;
261 | }
262 | }
263 | ```
264 |
265 | **This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.
266 |
267 | In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.
268 |
269 | If you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.
270 |
271 | ## Post-Processing CSS
272 |
273 | This project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it.
274 |
275 | For example, this:
276 |
277 | ```css
278 | .App {
279 | display: flex;
280 | flex-direction: row;
281 | align-items: center;
282 | }
283 | ```
284 |
285 | becomes this:
286 |
287 | ```css
288 | .App {
289 | display: -webkit-box;
290 | display: -ms-flexbox;
291 | display: flex;
292 | -webkit-box-orient: horizontal;
293 | -webkit-box-direction: normal;
294 | -ms-flex-direction: row;
295 | flex-direction: row;
296 | -webkit-box-align: center;
297 | -ms-flex-align: center;
298 | align-items: center;
299 | }
300 | ```
301 |
302 | There is currently no support for preprocessors such as Less, or for sharing variables across CSS files.
303 |
304 | ## Adding Images and Fonts
305 |
306 | With Webpack, using static assets like images and fonts works similarly to CSS.
307 |
308 | You can **`import` an image right in a JavaScript module**. This tells Webpack to include that image in the bundle. Unlike CSS imports, importing an image or a font gives you a string value. This value is the final image path you can reference in your code.
309 |
310 | Here is an example:
311 |
312 | ```js
313 | import React from 'react';
314 | import logo from './logo.png'; // Tell Webpack this JS file uses this image
315 |
316 | console.log(logo); // /logo.84287d09.png
317 |
318 | function Header() {
319 | // Import result is the URL of your image
320 | return ;
321 | }
322 |
323 | export default function Header;
324 | ```
325 |
326 | This ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths.
327 |
328 | This works in CSS too:
329 |
330 | ```css
331 | .Logo {
332 | background-image: url(./logo.png);
333 | }
334 | ```
335 |
336 | Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
337 |
338 | Please be advised that this is also a custom feature of Webpack.
339 |
340 | **It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
341 | An alternative way of handling static assets is described in the next section.
342 |
343 | ## Using the `public` Folder
344 |
345 | >Note: this feature is available with `react-scripts@0.5.0` and higher.
346 |
347 | Normally we encourage you to `import` assets in JavaScript files as described above. This mechanism provides a number of benefits:
348 |
349 | * Scripts and stylesheets get minified and bundled together to avoid extra network requests.
350 | * Missing files cause compilation errors instead of 404 errors for your users.
351 | * Result filenames include content hashes so you don’t need to worry about browsers caching their old versions.
352 |
353 | However there is an **escape hatch** that you can use to add an asset outside of the module system.
354 |
355 | If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`.
356 |
357 | Inside `index.html`, you can use it like this:
358 |
359 | ```html
360 |
361 | ```
362 |
363 | Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.
364 |
365 | When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.
366 |
367 | In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:
368 |
369 | ```js
370 | render() {
371 | // Note: this is an escape hatch and should be used sparingly!
372 | // Normally we recommend using `import` for getting asset URLs
373 | // as described in “Adding Images and Fonts” above this section.
374 | return ;
375 | }
376 | ```
377 |
378 | Keep in mind the downsides of this approach:
379 |
380 | * None of the files in `public` folder get post-processed or minified.
381 | * Missing files will not be called at compilation time, and will cause 404 errors for your users.
382 | * Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change.
383 |
384 | However, it can be handy for referencing assets like [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest) from HTML, or including small scripts like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.
385 |
386 | ## Adding Bootstrap
387 |
388 | You don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps:
389 |
390 | Install React Bootstrap and Bootstrap from NPM. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well:
391 |
392 | ```
393 | npm install react-bootstrap --save
394 | npm install bootstrap@3 --save
395 | ```
396 |
397 | Import Bootstrap CSS and optionally Bootstrap theme CSS in the ```src/index.js``` file:
398 |
399 | ```js
400 | import 'bootstrap/dist/css/bootstrap.css';
401 | import 'bootstrap/dist/css/bootstrap-theme.css';
402 | ```
403 |
404 | Import required React Bootstrap components within ```src/App.js``` file or your custom component files:
405 |
406 | ```js
407 | import { Navbar, Jumbotron, Button } from 'react-bootstrap';
408 | ```
409 |
410 | Now you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap.
411 |
412 | ## Adding Flow
413 |
414 | 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:
415 |
416 | ```js
417 | node_modules/fbjs/lib/Deferred.js.flow:60
418 | 60: Promise.prototype.done.apply(this._promise, arguments);
419 | ^^^^ property `done`. Property not found in
420 | 495: declare class Promise<+R> {
421 | ^ Promise. See lib: /private/tmp/flow/flowlib_34952d31/core.js:495
422 |
423 | node_modules/fbjs/lib/shallowEqual.js.flow:29
424 | 29: return x !== 0 || 1 / (x: $FlowIssue) === 1 / (y: $FlowIssue);
425 | ^^^^^^^^^^ identifier `$FlowIssue`. Could not resolve name
426 | ```
427 |
428 | To fix this, change your `.flowconfig` to look like this:
429 |
430 | ```ini
431 | [ignore]
432 | /node_modules/fbjs/.*
433 | ```
434 |
435 | Re-run flow, and you shouldn’t get any extra issues.
436 |
437 | ## Adding Custom Environment Variables
438 |
439 | >Note: this feature is available with `react-scripts@0.2.3` and higher.
440 |
441 | Your project can consume variables declared in your environment as if they were declared locally in your JS files. By
442 | default you will have `NODE_ENV` defined for you, and any other environment variables starting with
443 | `REACT_APP_`. These environment variables will be defined for you on `process.env`. For example, having an environment
444 | variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`, in addition
445 | to `process.env.NODE_ENV`.
446 |
447 | >Note: Changing any environment variables will require you to restart the development server if it is running.
448 |
449 | These environment variables can be useful for displaying information conditionally based on where the project is
450 | deployed or consuming sensitive data that lives outside of version control.
451 |
452 | First, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined
453 | in the environment inside a `