글

라벨이 javascript인 게시물 표시

RangeError: Maximum call stack size exceeded - 10 Causes and Fixes

이미지
RangeError: Maximum call stack size exceeded means your code called functions faster than it returned from them, until the JavaScript engine ran out of room to track them. Nine times out of ten it is a recursion that never reaches its base case — the classic javascript recursion error — but the tenth time it is a getter calling itself, a React effect re-triggering its own dependency, or a perfectly fine function fed 200,000 arguments at once. The stack is a fixed-size region the engine uses to remember where to return to. Every active call takes a frame. When frames exceed the limit, V8 throws this RangeError instead of corrupting memory. This page gives you the one-line fix first, then ten distinct causes with runnable reproductions, then a checklist for the case where your stack trace is just the same two frames repeated 10,000 times and tells you nothing. Error RangeError: Maximum call stack size exceeded Where it happens JavaScript — browser or Node.js, any framework. Th...

Error: A component is changing an uncontrolled input of type ... to be controlled. - 10 Causes and Fixes

이미지
React just logged Error: A component is changing an uncontrolled input of type ... to be controlled. in your console, and the input you were typing into probably still works - which is why this one is easy to ignore for weeks. It is not a crash; it is React telling you that a single <input> was mounted without a value prop (or with value={undefined} ) and then re-rendered with one. That switch matters because React manages the two kinds of inputs differently. An uncontrolled input keeps its text in the DOM node. A controlled input keeps it in your state and forces the DOM to match. Flipping between the two mid-life means React has to decide whose copy of the text wins, and the answer is not always the one you wanted - cursor jumps, wiped characters, and "my form resets when data loads" bugs all trace back here. This page covers the ten concrete ways a value prop goes from undefined to a string, each with a reproduction you can paste into a component, the lines ...