What is Ansible? An automation engine that allows for agentless system configuration and deployment. Ansible is an agentless automation tool that you install on a single host (referred to as the control node). From the control node, Ansible can manage an entire fleet of machines and other devices (referred to as managed nodes) remotely with […]
Author: Yujin Wang
React Rendering
It Always Re-renders By default, when the state of the component changes, this component and all its children re-render. But React updates a text node only when there’s visual change. “Rendering” of react component is not the same with “updating the DOM”. How to Prevent Re-renders memo() Wrapping a component with memo prevents the entire subtree of this component […]
Basic Knowledge of ImageFactory
What is Image? Virtual machines (VMs) in cloud are created from a template called a virtual server image. Virtual images can be sun up on cloud providers to do computing operations without purchasing hardware or software. what’s hardening? Hardening is the process of strengthening a system to reduce the exposure surface and attack vectors using […]
Table with max-height Scenario: source list is too long and table is without pagination Change display property of table to flex <thead /> allows no grow in height, width minus the width of scrollbar to keep the column width in form with <tbody /> <tbody /> occupies the rest height Change display property of table […]
[Package] react-beautiful-dnd
[Error] Cannot stop drag when no active drag Cause: conditionally add a new Droppable Solution: move Droppable to an upper level component Ref https://github.com/atlassian/react-beautiful-dnd/issues/1778#issuecomment-836542941
Number
Handle with Price: 2 decimal places Ref https://stackoverflow.com/questions/3163070/javascript-displaying-a-float-to-2-decimal-places
[Hook] useState
Overview This is a way to “preserve” some values between the function calls Normally, variables “disappear” when the function exits but state variables are preserved by React The state is only created the first time our component renders. During the next renders, useState gives us the current state. State variables can hold objects and arrays too. Update […]
[Package] styled-components
Motivation Automatic critical CSS: styled-components keeps track of which components are rendered on a page and injects their styles and nothing else, fully automatically. Combined with code splitting, this means your users load the least amount of code necessary. No class name bugs: styled-components generates unique class names for your styles. Simple dynamic styling: adapting […]
[Package] date-fns
Comparison with MomentJs date-fns vs moment Problems with Moment.js: It is highly based on OOP APIs, which makes it fail to work with tree-shaking, thus leading to a huge bundle size and performance issues. It is mutable and it causes bugs Complex OOP API (which doubles mutability problem) Advantages of date-fns Function per file Date-fns library consists […]
[Hook] – useEffect
Pure Function VS Side Effect The same input, it will always return the same output Predictable, reliable, and easy to test Side effects are not predictable because they are actions which are performed with the “outside world.” Making a request to an API for data from a backend server To interact with browser APIs (that is, to use document or window directly) […]