Skip to content

Commit

Permalink
polish: delete redundant previousComponent in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
RRDAWLX committed Sep 26, 2021
1 parent 98f130e commit 2d7ba34
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions hooks/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ let currentIndex;

/** @type {import('./internal').Component} */
let currentComponent;
/**
* Keep track of the previous component so that we can set
* `currentComponent` to `null` and throw when a hook is invoked
* outside of render
* @type {import('./internal').Component}
*/
let previousComponent;

/** @type {number} */
let currentHook = 0;
Expand Down Expand Up @@ -54,7 +47,7 @@ options.diffed = vnode => {
if (c && c.__hooks && c.__hooks._pendingEffects.length) {
afterPaint(afterPaintEffects.push(c));
}
currentComponent = previousComponent;
currentComponent = null;
};

options._commit = (vnode, commitQueue) => {
Expand Down

0 comments on commit 2d7ba34

Please sign in to comment.