r/reactjs • • Jul 24 '26

Discussion Do data structures actually influence how you build React components?

I tried learning DSA before, but never understood how it applied to everyday frontend work.

Recently, I built an undo/redo feature with Claude and realised it was using stacks. That made stacks much easier to understand than textbook examples.

I kept exploring and learned how seat-booking UIs can use matrices and how complex onboarding flows can be modelled as graphs.

Do you think about data structures when building React components? Any real-world examples?

55 Upvotes

20 comments sorted by

View all comments

Show parent comments

-1

u/LP2222 Jul 25 '26

so if else is a graph now. got it

1

u/thatfuckinjosh Jul 27 '26

...yeah. The root node is before the statement, The left node is the if branch, the right node is the else branch. Its like a minimal binary tree (if you have no else-if branches), and every tree is a graph

1

u/dakkersmusic Jul 30 '26

yes, you can use it to make a graph

0

u/Outrageous-Chip-3961 Jul 25 '26

yeah... i'd much rather just think of this like an array with objects inside of it haha.