React components are a mental model, not a file structure
One of the first things I tried to get right in React was the folder structure.
I reorganized the components three times in one week. Once by feature, once by UI type, and once by screen. I convinced myself that once the directories looked clean, the code would feel clean too.
It did not.
What eventually clicked was that React components are not primarily about where code lives. They are about what a piece of UI is responsible for. Until that distinction became clear, component design felt arbitrary, and refactors felt constant.
This post is about why folder-based thinking breaks down in React and how thinking in terms of ownership brings clarity.
The common misconception: Components as containers
Early on, it is easy to treat components as containers for markup and styles.
A structure like this feels reassuring:
components/
Button/
Button.jsx
Button.css
Modal/
Modal.jsx
Modal.css
Profile/
Profile.jsx
Profile.cssNothing here is wrong. It is tidy. It looks intentional.
The problem is what this structure encourages you to think about. When components are framed as folders, it is easy to start treating architectural decisions as placement questions. Should this logic live in Profile or in a child component? Should this state move up a level? Should this even be its own component?
Those questions feel like file organization problems, but they are not. A directory tree can tell you where code lives, but it cannot tell you which part of the UI should own a piece of behavior or data.
That distinction matters in React. The framework does not care where a component lives on disk. It cares which component is responsible for the data, interactions, and rendering involved.
This was the point where I stopped arguing with my components and started noticing what they were pushing back on.
Components as responsibility boundaries
The shift that helped most was reframing components as responsibility boundaries rather than visual groupings.
A component owns:
- The data it depends on.
- The events that can change that data.
- The rendering that reflects those changes.
In practice, ownership means this is where the state and logic live.
When all three live together, the component feels stable. When they are split arbitrarily, friction shows up quickly.
The React documentation emphasizes this same idea in its discussion of component design and state ownership, particularly in the section on thinking in React.
Consider a simple input component.
function SearchInput({ value, onChange }) {
return (
<input
value={value}
onChange={(e) => onChange(e.target.value)}
/>
);
}This component renders UI but owns nothing about its behavior. That might be correct, but only if the responsibility truly belongs elsewhere, such as when a parent component owns the state and logic by design, rather than by default. This usually makes sense only when multiple parts of the UI need the same value.
Get Sofia Marques’s stories in your inbox
Join Medium for free to get updates from this writer.
Early on, I defaulted to patterns like this without asking why. The result was components that existed mostly to pass props around. They were reusable in theory and awkward in practice.
The better question turned out not to be “Can this be reused?” but “Who actually owns this behavior?”
Why folder-based thinking fails
Folder-based thinking assumes hierarchy equals architecture. In React, that assumption quickly falls apart.
Two components can live side by side and have completely different responsibilities. Two components can live far apart and still be tightly coupled through shared state or effects.
This is why reorganizing files rarely fixes design problems. If state ownership is unclear, the discomfort will resurface as prop drilling (passing props through components that don’t use them), unexpected re-renders, or components that feel brittle to change.
React surfaces these issues early by forcing ownership decisions. The state must live somewhere. Effects must run somewhere. Data must flow in a direction. When those decisions are unclear, the code pushes back.
That pushback is not a failure of the code organization. It is feedback about how the mental model is being applied. In my case, it showed up as props being passed through components that didn’t actually care about them. The React documentation frames this tension explicitly in its discussion of lifting state up (moving shared state to the closest common parent), where questions of ownership determine whether components feel cohesive or awkwardly coupled.
The file structure shown here is illustrative. Component responsibilities do not need to map one-to-one to folders or files.
How React wants you to think about ownership
The most useful shift was to stop starting with folders and start with questions.
- Who owns this state?
- Who is allowed to change it?
- Who needs to react when it changes?
The component that answers all three is usually the right boundary.
Once that boundary is clear, file structure becomes secondary. Files can be colocated for convenience, split for readability, or reorganized later without changing the underlying design.
This is also why React emphasizes data flow. Clear ownership leads to predictable updates. Unclear ownership leads to components leaking responsibility into one another.
The goal is not fewer components or more components. The goal is components that make sense as units of responsibility.
Resources like Educative’s Learn React material reinforce this kind of boundary thinking through concrete examples of state ownership in practice.
From structure to clarity
Once this clicked, several things changed at once.
Components became easier to name, because they described what they owned rather than how they looked. Refactors became smaller, because responsibilities were clearer. Folder structures became simpler, because they stopped carrying architectural weight.
React components are not folders with JSX inside them. They are contracts about ownership in your UI. That is, they define where the state lives, where logic runs, and where changes are reflected. Kent C. Dodds has written extensively about this idea in the context of component design and composition, particularly around keeping state close to where it is used.
If component design has felt frustrating, it is often because a mental model problem is being solved with a file system solution. Adjust the framing, and much of that friction fades.
The next time you reach for a new folder, pause and ask: Who should actually own this?








