Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 711 Bytes

25-use-global-variables.md

File metadata and controls

20 lines (14 loc) · 711 Bytes
title permalink excerpt last_modified_at
Using Global Variables
/create-react-app/use-global-variables
2018-05-18 15:58:49 -0400

Using Global Variables

When you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.

You can avoid this by reading the global variable explicitly from the window object, for example:

const $ = window.$;

This makes it obvious you are using a global variable intentionally rather than because of a typo.

Alternatively, you can force the linter to ignore any line by adding // eslint-disable-line after it.