Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux源码学习 #11

Open
ghost opened this issue May 24, 2017 · 0 comments
Open

redux源码学习 #11

ghost opened this issue May 24, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented May 24, 2017

redux源码学习

准备知识

本文主要介绍redux的源码,学习其中的实现原理。阅读本文前,假设读者已经了解了redux中action、reducer和store的概念,并且已经能够使用,这些概念性的东西和使用方法我会另起一篇文章来介绍。

redux的源码短小而精干,其暴露出来的接口短短几十行代码,就让我们在使用的过程中仿佛云里雾里。在介绍redux的源码前需要复习几个重要的知识点。

闭包

闭包的概念就是允许一个函数使用另一个函数中的变量。没错,简单的概念就是这样。具体的使用形式为:

function f(a){
	return function(){
		console.log(a);
	}
}
var g = f('test');
g();//test  

返回的函数g能够使用函数f的变量a。闭包比较简单这里不再赘述。

函数增强


待补充

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants