Skip to main content

10 posts tagged with "study"

View All Tags

· 3 min read
Xiaohai Huang
  1. How do you decide when to run useLayoutEffect?

    Ans: useLayoutEffect is a version of useEffect that fires before the browser repaints the screen.

    • Measuring layout before the browser repaints the screen.
    • Blocks the browser from repainting.
  2. The execution order of useEffect and useLayoutEffect.

    FeatureuseEffectuseLayoutEffect
    Execution TimingRuns after the render is committed to the screen. This means it runs after the browser has painted changes to the screen.Runs synchronously after all DOM mutations. This means it runs before the browser has a chance to paint, making it suitable for reading layout from the DOM and synchronously re-rendering.
    Use CasesMost side effects (data fetching, subscriptions)DOM manipulation, measuring elements, critical layout updates
    PerformanceGenerally better performance due to async natureCan impact performance if used excessively, as it blocks the browser from repainting

· 14 min read
Xiaohai Huang

This study plan is for those who want to prepare for technical interviews but are uncertain which problems they should focus on. The problems have been carefully curated so that levels 1 and 2 will guide beginner and intermediate users through problems that cover the data structures and algorithms necessary to succeed in interviews with most mid-tier companies. While level 3 provides material to help users whose targets are top-tier companies. -- LeetCode

· One min read
Xiaohai Huang
  1. Browser cache. - cookie.
  2. Breadth-First Traversal and Depth First Traversal.
  3. script tag. async and defer.
  4. React Hook
var obj = {
a: 1,
foo: function (b) {
b = b || this.a;
return function (c) {
console.log(this.a);
console.log(b);
console.log(c);
};
},
};

var a = 2;
var obj2 = { a: 3 };

obj.foo(a).call(obj2, 1);
obj.foo.call(obj2)(1);

· 2 min read
Xiaohai Huang

When we are discussing about my projects. The interviewer asked the following questions:

  1. How do you achieve infinite play effect in a carousel?
  2. Use JS to achieve #id's scroll to element effect.
  3. CSS animation.

After done talking my projects, I was asked a few questions about Promise, linked list, and heap sort, insertion sort.

· One min read
Xiaohai Huang

git stash with a stash name.

git stash push -m "stash_name"

stash untracked files

git stash push -u -m "stash_name"
git stash push --include-untracked -m "stash_name"