This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel-polyfill'); | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {createStore, applyMiddleware, compose} from 'redux'; | |
import thunk from 'redux-thunk' | |
import {Provider, connect} from 'react-redux'; | |
/************ ACTION CONSTANTS AND ACTION CREATORS ************/ | |
const ADD_REPOSITORY = 'ADD_REPOSITORY'; | |
const addRepository = repository => ({type: ADD_REPOSITORY, repository}); |
-
What is scope? Your explanation should include the idea of global vs. local scope.
Scope is the concept of where a variable can be accessed. Variables should usually be created within the scope of a function instead of being created as properties of the global object ('window' in the browser). A local variable is one that has been declared in the context of the current function.
-
Why are global variables avoided?
Global variables create many problems including unintended consequences and incompatibilities between libraries or files. They also make finding errors more difficult because it's harder to narrow down the source of some problems.
NewerOlder