DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 118 of Learning MERN Stack

Hello Dev Community! 👋

It is Day 118 of my software engineering sprint, and today I unlocked the superpower of Reactivity! Today, I moved beyond standard event-listening log displays and dived deep into State Management using the useState Hook! ⚛️ dynamic

In traditional frontend development, changing an element's data on screen requires manually locating the target node and injecting new text strings. React changes this layout paradigm entirely: you change the data state, and React automatically computes the diffs and updates the user interface instantly!


🛠️ Deconstructing the Day 118 Architecture

As captured in my local Workspace Snapshot ("Screenshot (264).png"), I shifted my hardcoded static mock lists right into an active, live-updating application state:

1. Hook Initialization & State Setup

  • Formatted the functional component state array to securely hold incoming list items dynamically:

javascript
  const [healthyFoods, setHealthyFoods] = useState([]);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)