본문 바로가기

프로그래밍256

[시스템 프로그래밍] 컴퓨터 구조 윈도우즈 시스템 프로그래밍이란? 윈도우즈 운영체제 기반의 컴퓨터에게 일을 시키는 프로그램을 개발하는 것 CPU(Central Processing Unit) 중앙처리장치, 프로그램의 연산을 담당한다. 메인 메모리(Main memory) 컴파일이 완료된 프로그램 코드가 올라가서 실행되는 영역이다. 입출력 버스(Input/Output Bus) 컴퓨터를 구성하는 요소 사이에서 데이터를 주고 받는 통로 역할을 한다. CPU에 대한 이해 ALU(Arithmetic Logic Unit) CPU 내에 존재하는 블록으로 덧셈이나 뺄셈과 같은 산술 연산 및 논리 연산을 처리한다. 컨트롤 유닛(Control Unit) 명령어에 대한 정보를 해석한다. 레지스터 세트(Register Set) 데이터를 저장하거나 데이터의 주소를.. 2023. 12. 3.
[React] useReducer useReducer useReducer is a React Hook that lets you add a reducer to your component. const [state, dispatch] = useReducer(reducer, initialArg, init?) Parameters reducer: The reducer function that specifies how the state gets updated. It must be pure, should take the state and action as arguments, and should return the next state. State and action can be of any types. initialArg: The value from w.. 2023. 11. 30.
[React] createContext createContext createContext lets you create a context that components can provide or read. const SomeContext = createContext(defaultValue) Parameters defaultValue: The value that you want the context to have when there is no matching context provider in the tree above the component that reads context. If you don’t have any meaningful default value, specify null. The default value is meant as a “.. 2023. 11. 29.
[React] useContext useContext useContext is a React Hook that lets you read and subscribe to context from your component. const value = useContext(SomeContext) useContext는 넘긴 context 값을 반환한다. 컨텍스트 값을 결정하기 위해 리액트는 컴포넌트 트리를 검색하고 가장 가까운 컨텍스트 프로바이더를 찾는다. 컴포넌트에 Provider로 감싸거나 부모 컴포넌트 중에 하나를 감싸라. (매칭되는 컨텍스트 프로바이더로) import { useContext } from 'react'; function Button() { const theme = useContext(ThemeContext); // ... fun.. 2023. 11. 29.
[React] forwardRef forwardRef forwardRef lets your component expose a DOM node to parent component with a ref. const SomeComponent = forwardRef(render) Parameters render: The render function for your component. React calls this function with the props and ref that your component received from its parent. The JSX you return will be the output of your component. Returns forwardRef returns a React component that you .. 2023. 11. 29.
[React] memo memo memo lets you skip re-rendering a component when its props are unchanged. const MemoizedComponent = memo(SomeComponent, arePropsEqual?) Parameters Component: The component that you want to memoize. The memo does not modify this component, but returns a new, memoized component instead. Any valid React component, including functions and forwardRef components, is accepted. optional arePropsEqu.. 2023. 11. 29.
[React] useMemo useMemo useMemo is a React Hook that lets you cache the result of a calculation between re-renders. const cachedValue = useMemo(calculateValue, dependencies) Parameters calculateValue: The function calculating the value that you want to cache. It should be pure, should take no arguments, and should return a value of any type. React will call your function during the initial render. On next rende.. 2023. 11. 29.
[React] useCallback useCallback useCallback is a React Hook that lets you cache a function definition between re-renders. const cachedFn = useCallback(fn, dependencies) Parameters fn: The function value that you want to cache. It can take any arguments and return any values. React will return (not call!) your function back to you during the initial render. On next renders, React will give you the same function agai.. 2023. 11. 28.
[React] useRef useRef useRef is a React Hook that lets you reference a value that’s not needed for rendering. const ref = useRef(initialValue) Parameters initialValue: The value you want the ref object’s current property to be initially. It can be a value of any type. This argument is ignored after the initial render. Returns useRef returns an object with a single property: current: Initially, it’s set to the .. 2023. 11. 28.
[React] useEffect useEffect useEffect is a React Hook that lets you synchronize a component with an external system. useEffect(setup, dependencies?) 예시) useEffect(() => { const connection = createConnection(serverUrl, roomId); connection.connect(); return () => { connection.disconnect(); }; }, [serverUrl, roomId]); Parameters setup: The function with your Effect’s logic. Your setup function may also optionally re.. 2023. 11. 28.