클로저 (Clousre)

어떻게 가능한가?

클로저 활용 1. 은닉화

const user=()=>{
	let name = '';
	return {
		getUserName:()=>{
			return name;
		},
		setUserName:(_name:string)=>{
			name=_name;
		}
	}
}

클로저 활용2. 부분적용함수

클로저 활용3. 커링(Currying)

	const reduxThunk = (store) => (next) => (dispatch) => {
		reutrn typeof action === 'function' ? action(dispatch, store,getState) : next(action);
	}

https://developer.mozilla.org/ko/docs/Web/JavaScript/Closures