Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 1, 2022
1 parent 511ebe1 commit bf5f5f6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions compat/src/index.d.ts
Expand Up @@ -24,6 +24,7 @@ declare namespace React {
export import useDebugValue = _hooks.useDebugValue;
export import useEffect = _hooks.useEffect;
export import useImperativeHandle = _hooks.useImperativeHandle;
export import useId = _hooks.useId;
export import useLayoutEffect = _hooks.useLayoutEffect;
export import useMemo = _hooks.useMemo;
export import useReducer = _hooks.useReducer;
Expand Down
2 changes: 1 addition & 1 deletion hooks/src/index.d.ts
Expand Up @@ -138,4 +138,4 @@ export function useErrorBoundary(
callback?: (error: any) => Promise<void> | void
): [any, () => void];

export function useId<T>(): string;
export function useId(): string;
7 changes: 3 additions & 4 deletions hooks/src/index.js
Expand Up @@ -41,13 +41,13 @@ options._diff = vnode => {
// this is the first component rendered and hasn't been seen, it's a root:
vnode._mask = mask = '';
} else {
// replace mask[depth] with the next character: (basically *mask[depth-1]++)
// replace mask[depth] with the next: (basically *mask[depth-1]++)
const offset = Number(mask[depth - 1]) + 1;
vnode._mask = mask = mask.slice(0, depth - 1) + offset;
}
// we're about to render the children of this component, push a new level onto the mask:

depth++;
mask += '0'; // next level starts off at the base character (code 65) again
mask += '0';
}
currentComponent = null;

Expand Down Expand Up @@ -85,7 +85,6 @@ options.diffed = vnode => {
if (oldAfterDiff) oldAfterDiff(vnode);

if (typeof vnode.type === 'function' && vnode.type !== Fragment) {
// jump back up the stack, remove the last char from the mask:
depth--;
mask = mask.slice(0, -1);
}
Expand Down

0 comments on commit bf5f5f6

Please sign in to comment.