본문 바로가기

반응형

전체 글

(522)
리액트 훅 - 유즈이펙트 (컴포넌트 상태변화 감지) 유즈이펙트는 리액트의 훅 중 하나로 컴포넌트 등의 상태가 변할 때 이를 감지할 수 있게 해 줍니다. 프로젝트 구성하기 리액트 앱 생성 리액트? 리액트는 자바스크립트 라이브러리로 앵귤러, 뷰와 함께 3대 자바스크립트 프레임워크 중 하나입니다. 앵귤러와 마찬가지로 컴포넌트 단위로 UI를 구성하는 방식을 사용하지만 앵귤러와 달리 jin-co.tistory.com 사용방법 사용하고자 하는 컴포넌트에 유즈이펙트를 가져오고 아래처럼 설정합니다. 감지하고자 하는 대상이 있다면 아래처럼 꺽쇠를 추가하고 그 안에 추적대상을 추가하면 대상의 상태가 변화할 때마다 훅이 작동합니다 (이벤트와 비슷) 사용예시 콘텍스트 생성 유즈콘텍스트를 생성하고 아래와 같이 상태를 설정합니다 컴포넌트 생성 테스트를 위한 컴포넌트를 생성하고 유..
Generic Pattern - Unit of Work Pattern The generic pattern allows us to use the same method for a different set of entities. However, it also creates a problem that related entities are partially updated which will lead to an error not to mention that we have to inject each entity separately. To solve this problem, we will see another pattern called the unit of work. HTML 삽입 미리보기할 수 없는 소스
지네릭 패턴 - 유닛 오브 워크 지네릭 패턴은 엔티티 타입을 변경할 수 있게 해 주어 메서드를 공유할 수 있지만 각 엔티티 별로 구현체를 생성하므로 중복적인 인젝션과 다른 객체로 인식되어 엔티티 간에 서로 의존관계가 있는 경우 하나의 엔티티에 정보 등록이 실패할 경우 이로 인해 에러가 발생할 수 있는 단점이 있습니다. 이러한 문제를 해결하기 위해 각 엔티티를 하나의 워크 유닛으로 묶어 구현하는 유닛오브 워크 패턴을 살펴보겠습니다. HTML 삽입 미리보기할 수 없는 소스
Hooks - useContext(Global State) The useContext is one of the hooks in React. It manages the status of the application like useState with a twist that it does this on a global scope. So unlike useState where a status should be passed from one component to another, any component can access the context regardless of its position hence making it an excellent fit for global status management. HTML 삽입 미리보기할 수 없는 소스
리액트 훅 - 유즈콘텍스트 (글로벌 스테이트) 유즈콘텍스트는 리액트의 훅 중 하나로 유즈스테이트와 같이 애플리케이션의 상태를 관리하는 기능을 제공합니다. 다른 점은 연결된 컴포넌트 사이에서만 데이터를 주고받을 수 있는 유즈스테이트와 달리 어느 컴포넌트에서든 콘텍스트에 설정된 데이터에 대한 접근이 가능하여 글로벌 스테이트 관리에 용이합니다. HTML 삽입 미리보기할 수 없는 소스
Generic TypeScript is a strongly type language and it significantly reduces the type errors while in development which would not be possible with mare JS. At the same time it also reduces the reusability of codes. If you want both the feature, The generic is a way to go. Without further ado, let's see how we can use the Generic Without Type Checking Below is an example of JavaScript code. JavaScript is ..
Decorator The decorator in TypeScript is a feature that enables us to add meta data or business logic without having to change the orginal code format. For example, when we have multiple classes with the same attribute name, type, with the same value, we can use the decorator to reduce redundancy How to Use It? This feature is in test at the moment, so we need a set up to use this. Open the console and ru..
Server Memory - Redis Redis is a server memory that stores data with a key-value pair. It does not depend on the database so it takes the burden of having to manage the data and it is fast. In addition, compared to local storage, another option to store data without depending on a database, it gives us control over the data. Well, enough talking, let's get into it. Why Do We Use It? Fast Control over the data Persist..

728x90