State
ELI5 — The Vibe Check
State is a component's memory — data that can change over time and causes the UI to update when it does. Think of a counter: the number is state. When it changes, the screen updates automatically. Without state your app is just a static poster.
Real Talk
State is mutable data managed by a component or store that, when changed, triggers a re-render. Local state lives inside a component (useState in React, ref/reactive in Vue). Global state is shared across components via stores like Pinia, Redux, or Zustand.
Show Me The Code
// React
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(count + 1)}>{count}</button>;
}
When You'll Hear This
"The modal's open/closed is local state — don't put it in the global store." / "When the state updates the component re-renders."
Related Terms
Component
A component is a self-contained LEGO brick for your UI.
Composable
Composables are Vue's version of React hooks — reusable functions that bundle reactive state and logic together.
Hook
Hooks are special functions in React that let function components use superpowers like state and lifecycle that used to be class-only.
Props
Props are how you pass information INTO a component, like giving a coffee machine its settings.
Reactive
Reactive means your data and your UI are connected — when the data changes, the screen updates automatically, like magic.