Day 123 of Learning MERN Stack

์ž‘์„ฑ์ž

์นดํ…Œ๊ณ ๋ฆฌ:

โ† ํ”ผ๋“œ๋กœ
DEV Community ยท Ali Hamza ยท 2026-07-09 ๊ฐœ๋ฐœ(SW)

Ali Hamza

Hello Dev Community! ๐Ÿ‘‹

It is officially Day 123 of my software development sprint! Today, I transitioned from traditional reactive states into state-machine territory by mastering the useReducer Hook in React! โš›๏ธ Unified State Management

When your app state shifts from primitive variables to complex data patterns containing multi-layer transformations, relying on unorganized useState setters spreads logic thin across files. Today, I centralized my component’s business logic completely into a single state processing hub!

๐Ÿ› ๏ธ Deconstructing the Day 123 Action Pipeline

As captured across my workspace workspace template files in “Screenshot (274).png”, my state execution flow now implements strict architectural separation:

1. Designing the Pure Reducer function

  • Formatted an isolated data processing engine (Reducerfunction) outside the UI class hierarchy to act as a pure function:

javascript
  function Reducerfunction(currState, action) {
      if (action.type === "NEW_ITEM") {
          return [
              ...currState,
              { name: action.payload.todoNameParas, date: action.payload.todoDateParas }
          ];
      }
      return currState;
  }

Enter fullscreen mode Exit fullscreen mode

์›๋ฌธ์—์„œ ๊ณ„์† โ†—

์ถ”์ถœ ๋ณธ๋ฌธ ยท ์ถœ์ฒ˜: dev.to ยท https://dev.to/ali_hamza_589ec7b3eb6688d/day-123-of-learning-mern-stack-4cbk

์ฝ”๋ฉ˜ํŠธ

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค