Open in app

Sign In

Write

Sign In

Ivy Lyu
Ivy Lyu

6 Followers

Home

About

Jul 4, 2021

How to mock window object in Jest with deep-rooted methods called

Recently I have some unit tests need to mock window object and implement some methods of it, and it is a deep-rooted object which is hard to mock but luckily I found some useful document and winged a bit and then boom! Happy Ending! I was implementing a payment solution…

React

2 min read

How to mock window object in Jest with deep-rooted methods called
How to mock window object in Jest with deep-rooted methods called
React

2 min read


Jun 27, 2021

useCallback VS useMemo in two lines

TLDR useCallback: “cache a function in a functional component” useMemo: “cache an attribute in a functional component” General Usecase “I don’t want my child component to be re-rendered if only part of my state that are irrelevant to my child component has changed” You will start to think of those scenarios when you…

React

2 min read

useCallback VS useMemo in two lines
useCallback VS useMemo in two lines
React

2 min read


May 30, 2021

Git — How to break a large merge request into several small ones

The other day I was about to submit my final merge request to GitLab, but I realized that there were 33 commits and over 20 files changed, I should realize it in the very beginning, but it was hard when I started to work on a feature and don’t want…

Git

2 min read

Git — How to break a large merge request into several small ones
Git — How to break a large merge request into several small ones
Git

2 min read


Nov 10, 2019

Redux learning

I’m learning react-redux through building a shopping website, I wasn’t totally mastering it but I have to write something to clear my thoughts. Config Redux It takes time to config redux before implementing any functions related to this. The very first movement is to npm install react-redux redux and redux-logger. …

React

2 min read

React

2 min read


Nov 3, 2019

JS Array shallow copy && JS polling implementation && one of using Mobx pitfalls

Well, these should be three separate topics but I just want to do a quick sum-up of what I learned today. Shallow Copy shallow copy only copy one layer of the original array, what I mean by one layer is like that: const oriArr = ["1","2","3"]; const copyArr = oriArr.slice(); …

JavaScript

2 min read

JavaScript

2 min read


Oct 24, 2019

Cleaning Nodejs/Express Code Smell

Hi there, I did a code test about cleaning the Nodejs/Express code smell and I realized I did not fully understand how Nodejs/Express works and what are the newest writing styling used ES6/7 syntax. …

Nodejs

3 min read

Nodejs

3 min read

Ivy Lyu

Ivy Lyu

6 Followers
Following
  • Carlos Caballero

    Carlos Caballero

  • James Williams

    James Williams

  • Ross Bulat

    Ross Bulat

  • Aditya Agarwal

    Aditya Agarwal

  • Baris Ozcetin

    Baris Ozcetin

See all (16)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams