Comments (31)
写的好棒!一看就明白了,感谢感谢
from blog.
666.写这么详细。我今天才重构了我的第一篇文章。
from blog.
为什么函数里还要套上一层函数?
function wrapWithUsername(wrappedFunc) {
let newFunc = () => {
let username = localStorage.getItem('username');
wrappedFunc(username);
};
return newFunc;
}
这样写不行吗?
function wrapWithUsername(wrappedFunc) {
let username = localStorage.getItem('username');
wrappedFunc(username);
}
不返回一个新的函数,外面怎么调用?
from blog.
写的非常的好
from blog.
好棒,我也来看啦
from blog.
受教了
from blog.
清晰易懂,感谢分享
from blog.
讲解通俗易懂,满分!
from blog.
写的好棒~瞬间理解了
from blog.
不错,通俗易懂
from blog.
讲的很赞
from blog.
666
from blog.
写的太好了,你这么大神我们加下QQ号吧,日后可以更好的交流3154329581
from blog.
记得加我啊
from blog.
感谢
from blog.
喜欢这种不装B的直白描述
from blog.
挺好的文章!
from blog.
厉害
from blog.
前面用函数做例子后面再引入组件很棒,没有那么多虚头巴脑的名词,浅显易懂,赞!
from blog.
必须赞,写的太好了
from blog.
666,简单明了,太棒了
from blog.
很棒
from blog.
清晰明了,赞~
from blog.
为什么函数里还要套上一层函数?
function wrapWithUsername(wrappedFunc) {
let newFunc = () => {
let username = localStorage.getItem('username');
wrappedFunc(username);
};
return newFunc;
}
这样写不行吗?
function wrapWithUsername(wrappedFunc) {
let username = localStorage.getItem('username');
wrappedFunc(username);
}
from blog.
通熟易懂
from blog.
from blog.
直白易懂
from blog.
醍醐灌顶
from blog.
666
from blog.
不错不错
from blog.
函数 wrapWithUsername (wrappedFunc) { let newFunc = () => { let username = localStorage.getItem('username'); WrappedFunc(用户名); }; 返回新函数; } 这样写不行吗? function wrapWithUsername(wrappedFunc) { let username = localStorage.getItem('username'); WrappedFunc(用户名); }
您仔细看,返回的是一个回调函数,类似函数柯里化
from blog.
Related Issues (20)
- 如何升级到 React 18 HOT 1
- React 18 对 Hooks 的影响:一
- React 18 总览 HOT 1
- 我认为 web3 是什么(大白话 web3) HOT 3
- React useEvent:砖家说的没问题
- Base64 编码原来这么简单 HOT 2
- issue一般啥时候用? HOT 1
- 我要去哪里?- 写在我的 30 岁 HOT 9
- 前端好还是后端好,看看7年前端和后端怎么说 HOT 2
- 只想做开源项目、技术项目,不想做业务,有办法吗?
- 前端小白半年准备进大厂
- 程序员如何实现财富自由 HOT 1
- 离职后聊一聊我眼中的蚂蚁 HOT 2
- 前端工程师个人的价值在哪里(换一个人能不能做?)【前端晋升必看】
- rm
- 2022 年:我在死亡边缘走过 HOT 4
- 前端质量体系之纸上谈兵 HOT 1
- 大白话虚拟货币理财原理 HOT 1
- 前端没了?也许是刚开始
- Telegram bot 和 mini apps 开发简易教程
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.